PDA

View Full Version : linking to the next page


ikris
08-30-2002, 07:19 PM
Ok, I have two questions...

Here is the link to a page in my image gallery: http://version.not-impossible.org/photos/sgs.php?gal=gallery/fan_signs/&pge=0 Now, I have two more pages in that gallery. I need to know how to link to the next page (not directly the next page, I know how to do that) What I mean is to do it globally (since this is on a template) so that on each page it will have the link to the next or previous page. And my other question is: What would the code be to show how many pages total I have in that gallery? Thanks for any help.

Jasonb61
08-30-2002, 11:12 PM
IM not sure if I get your question... you want to know how to make it link back and forth between pages right?

I'd do somthing like this....


//First Get the current page number
$CURPG = $HTTP_GET_VARS["pge"];
$BACKPG = $CURPG - 1;
$FORPG = $CURPG + 1;
=== Place the code below where you want the back link ===
If ($CURPG == 0) {
//No Page to go back to...
echo "Back";
}
else
{
// There are pages to go back to..
echo "<a href=\"page.php?&pge=$BACKPG\">Back</a>";
}
=== Place the code below where you want the forward link ===
If ($CURPG == $XXX) {
//No more pages to go forward to..
// NOTE: $XXX Needs to be the Total Amount of Pages you have
echo "Forward";
}
else
{
// There are pages to go to..
echo "<a href=\"page.php?&pge=$FORPG\">Forward</a>";
}


(I am kind of new to PHP, so please excuse any errors... Im trying to help:D)