View Full Version : PHP Links...


Mr. Initial Man
07-20-2005, 10:32 PM
I have seen this as a way of going through a series of images:

<?php
$pictures=array("pic0.jpg","pic1.jpg");

$max = count($pictures); // get total images

$i = (isset($_GET['page'])) ? $_GET['page'] : 0;
$iprev = ($i == 0) ? $max - 1: $i - 1;
$inext = ($i == $max -1) ? 0 : $i +1;

?>
<img src="images/<?php echo $pictures [$i]; ?>" width="?px" height="?px"/>
<a href="pics.php?page=<?php echo $iprev; ?>">Previous</a>
<a href="pics.php?page=<?php echo $inext; ?>">Next</a>

Can I use it to go through a series of HTM inserts?

What I was thinking of using is:

<?php
$inserts=array("comic000.htm","comic001.htm, comic002.htm");

$max = count($inserts); // get total inserts

$i = (isset($_GET['page'])) ? $_GET['page'] : 0;
$iprev = ($i == 0) ? $max - 1: $i - 1;
$inext = ($i == $max -1) ? 0 : $i +1;

?>
<?php insert $inserts [$i]; ?>

<a href="chronology.php?page=<?php echo $iprev; ?>">Previous</a>
<a href="chronology.php?page=<?php echo $inext; ?>">Next</a>

Would this work?

bejayel
07-20-2005, 11:49 PM
i dont see why not...why dont yout just test it? also you forgot two quotes in your array. dont forget to make sure everything is right or you will get a pretty error.