AviNahum Posted July 12, 2009 Share Posted July 12, 2009 hey, i made an simple images gallery... i'm using this code: <?php public function album_right($id, $s) { global $cms, $DB, $std; $DB->query("SELECT * FROM cms_gal_images WHERE album={$id}"); $c = $DB->get_num_rows(); $z = $c/100; $count = 0; while ($r = $DB->fetch_row()) { $b = ''.$cms->admin_dir.'/gallery/'.$r['url'].''; $a .= '<td width="'.$z.'%" align="center"><div style="background-color: #f3f3f3; border: .75pt solid #CCCCCC; padding: 4px;"><img src="'.$cms->admin_dir.'/gallery/'.$r['url'].'" width="'.$s['little_width'].'" height="'.$s['littile_h'].'" onclick="ch(this.src)"></div></td>'; $count++; if ($count == $s['nprr']) { $count = 0; $a .= "</tr><tr>"; } } return <<<EOF <script type="text/javascript"> function ch(str) { var x=document.getElementById("big") x.src=str; } </script> <table width="100%" cellpadding="0" cellspacing="0"> <tr> <td valign="top"> <table width="100%" cellpadding="1" cellspacing="0"> <tr>{$a}</tr> </table> </td> <td width="1%"></td> <td valign="top"> <div align="center" style="background-color: #f3f3f3; border: .75pt solid #CCCCCC; padding: 4px;"> <img src="{$b}" width="{$s['big_width']}" height="{$s['big_h']}" id="big"> </div> </td> </tr> </table> EOF; } ?> its simple, i select all the images from the DB and display them on the side of the screen on small width... at the center of the screen there are big image and when you press one of the small images, the big will be replaced with the image you choose... my code works fine... but in the images table, there another colum that stores for each image some description... my problem is to display the description for each image and when the big image changes so the description changes to... i wasn't sure if it's belong to PHP or JS so i posted it here... Thanks! ***sorry for poor englsih*** Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.