View Single Post
Old 06-25-2009, 10:21 AM   #6 (permalink)
Foxtrck
Contributing Member
 
Foxtrck's Avatar
 
Join Date: 11-29-06
Location: Scotland, UK
Posts: 201
iTrader: 0 / 0%
Latest Blog:
None

Foxtrck is liked by somebodyFoxtrck is liked by somebodyFoxtrck is liked by somebodyFoxtrck is liked by somebodyFoxtrck is liked by somebody
Send a message via MSN to Foxtrck
Ok, so I used this php

PHP Code:
$result_publication mysql_query($query_publications) or die(mysql_error()); 
        
$num_rows_publication mysql_num_rows($result_publication);
        
header_search_results();

               for(
$i=0$i<$num_rows_publication$i++) 
            { 
                echo (
"<p>" mysql_result($result_publication$i"pubName") . "<a id='displayText' href='javascript:toggle();'> Show Available Languages</a></p>");
         
                 
                
$query_files "SELECT * FROM files WHERE pubId = " .  
                
mysql_result($result_publication$i"id") . " ORDER BY files.language"
                         
                        
$result_languages mysql_query($query_files) or die(mysql_error());  
                         
                        
$num_rows_languages mysql_num_rows($result_languages); 
                         echo(
"<div id='toggleText' style='display:none'>"); 
                        for(
$j=0$j<$num_rows_languages;$j++) 
                        {                 
                            
                            echo(
"<table>");                         
                            echo(
"<tr><td class='language'>
                            <a href='" 
mysql_result($result_languages$j"file") . "'>" mysql_result($result_languages$j"language") . "</a></td></tr>"); 
                            echo(
"</table>"); 
                             
                        } 
                         echo(
"</div>");
                echo(
"<hr/>"); 
            }  


    } 
with the following JS

Code:
<script language="javascript"> function toggle() { var ele = document.getElementById("toggleText"); var text = document.getElementById("displayText"); if(ele.style.display == "block") { ele.style.display = "none"; text.innerHTML = "Show Available Languages"; } else { ele.style.display = "block"; text.innerHTML = "Hide Languages"; } } </script>
and the concept works with hidding divs


BUT the problem is, only the first result uses the hiding div. Is there a way to loop through every one? How would i change it to search by class?

Sorry, any suggestions... lack of sleep is making me this noobish again
__________________
http://www.dund.co.uk - DD1 Designs
Foxtrck is offline   Reply With Quote