Page 1 of 1

Previous / Next arrows for skipping through pages

Posted: Thu Aug 19, 2010 4:23 pm
by testing1
Hi Johannes and other Wizards of the Web,

Is there a way to use Previous / Next arrows to skip through (WEBYEP_DI=X) pages? For example, one of my templates will be called "members.php", I will add to this list regularly. The visitor will click the Previous / Next arrows and skip through WEBYEP_DI=0001 - WEBYEP_DI=1000. I'm guessing I'll just have 100 pages created, maximum, but I need the freedom of a long range.

the arrows could be an image or this

Code: Select all

&larr Previous | Next &rarr

I'm interested in applying a piece of code that only skips through a designated number of WEBYEP_DI=X…

Any help is appreciated?

Re: Previous / Next arrows for skipping through pages

Posted: Thu Aug 26, 2010 5:31 pm
by johannes
First, please note that the URL query argument changed from WEBYEP_DI to DOC_INST in WebYep 1.4.6.

The code you are asking for could look something like this:

Code: Select all

<div><?php
   $iMaxDocID = 100;
   $sSelf = $_SERVER['PHP_SELF'];
   $iDocID = isset($_GET['DOC_INST']) ? (int)$_GET['DOC_INST']:0;
   $sPrevText = "&larr; Previous";
   $sNextText = "Next &rarr;";
   if ($iDocID > 1) printf("<a href=\"%s?DOC_INST=%d\">%s</a>", $sSelf, $iDocID - 1, $sPrevText);
   else echo $sPrevText;
   echo " | ";
   if ($iDocID < $iMaxDocID) printf("<a href=\"%s?DOC_INST=%d\">%s</a>", $sSelf, $iDocID + 1, $sNextText);
   else echo $sNextText;
?></div>


The main problem with this code is, that it cannot determine how many pages are actually filled with content!
So it will offer the "next" link even if the next page actually has no content...:(

Re: Previous / Next arrows for skipping through pages

Posted: Mon Jan 17, 2011 3:32 am
by testing1
Hi Johannes,

The code works great. Currently, when I hide a page within the loop element, it still shows up when the user click previous/next.

Example: using the previous/next arrow, the user goes from DOC_INST=1 to DOC_INST=10 with every page page in between showing up. Is there a way the code can "skip" any pages that are hidden?

Thanks!
8)

Re: Previous / Next arrows for skipping through pages

Posted: Mon Jan 17, 2011 1:11 pm
by marcus
testing1 wrote:Is there a way the code can "skip" any pages that are hidden?

I'm afraid, this isn't possible at the moment.