View Single Post
  #4 (permalink)  
Old 02-05-2008, 06:55 PM
curtiss's Avatar
curtiss curtiss is offline
Moderator
 
Join Date: May 2003
Posts: 1,468
It's pretty simple really. You'll want to play a bit with query strings (the $_GET global variables) to make the page do what you want, depending on what information you feed it.

If I'm understanding what you're asking, you would want to create a function something like the following, and then call it within your "pageofimages.php" file:
PHP Code:
<?php
function showlist() {
    echo 
'<ul>\n\r';
    
$myimgs = array('pic1.jpg'=>'Picture 1','pic2.jpg'=>'Picture 2','pic3.jpg'=>'Picture 3','pic4.jpg'=>'Picture 4');
    foreach 
$myimgs as $imgname=>$imgdesc {
        echo 
'\t<li><a href="picviewer.php?picname='.$imgname.'">'.$imgdesc.'</a>\n\r';
    }
    echo 
'</ul>';
}
?>
Then, the code within picviewer.php (your "single-page") would look something like:
PHP Code:
<?php
if(!empty($_GET['picname'])) {
?>
<img src="<?php echo $_GET['picname'];?>" />
<?php
}
else {
?>
There is no image to show
<?php
}
?>
__________________
I hate Internet Explorer! Anyone with me?
Reply With Quote