Show Prev and Next page links only when page limit exceeded
3 posts by 2 authors in: Forums > CMS Builder
Last Post: February 23, 2009 (RSS)
Hello all!
We're using the "<< prev - page 1 of 1 - next >> " page links, but we only what the "<< prev - page 1 of 1 - next >>" text to display if the record number has been exceeded. So, for instance, if our limit is 15 records per page, we only want to see the prev/next page links once a 16th record has been added.
I know this should be pretty straight forward, but not being very PHP savy, I don't have a clue how to do this.
Thanks, in advance, for any assistance!
Jeremy
We're using the "<< prev - page 1 of 1 - next >> " page links, but we only what the "<< prev - page 1 of 1 - next >>" text to display if the record number has been exceeded. So, for instance, if our limit is 15 records per page, we only want to see the prev/next page links once a 16th record has been added.
I know this should be pretty straight forward, but not being very PHP savy, I don't have a clue how to do this.
Thanks, in advance, for any assistance!
Jeremy
---------------------------
Dwelling Productions
www.dwellingproductions.com
Dwelling Productions
www.dwellingproductions.com
Re: [dwelling] Show Prev and Next page links only when page limit exceeded
By Dave - February 23, 2009
Hi Jeremy,
So, when it displays "page X of Y" you only want that to show if the Y value is greater than one? If that's right you can do that as follows. Search your code for 'totalPages', you'll find some php code that looks like this: <?php echo $newsMetaData['totalPages'] ?>
Note that is will have a different variable name (newsMetaData) depending on what you named your table. Copy that code into an if block like this:
<?php if ($newsMetaData['totalPages'] > 1): ?>
... content you want displayed here ...
<?php endif ?>
Hope that helps! Let me know if that works for you.
So, when it displays "page X of Y" you only want that to show if the Y value is greater than one? If that's right you can do that as follows. Search your code for 'totalPages', you'll find some php code that looks like this: <?php echo $newsMetaData['totalPages'] ?>
Note that is will have a different variable name (newsMetaData) depending on what you named your table. Copy that code into an if block like this:
<?php if ($newsMetaData['totalPages'] > 1): ?>
... content you want displayed here ...
<?php endif ?>
Hope that helps! Let me know if that works for you.
Dave Edis - Senior Developer
interactivetools.com
interactivetools.com
Re: [Dave] Show Prev and Next page links only when page limit exceeded
Dave,
That works perfectly! Thanks so much. Now I can let my brain rest! :-)
Jeremy
That works perfectly! Thanks so much. Now I can let my brain rest! :-)
Jeremy
---------------------------
Dwelling Productions
www.dwellingproductions.com
Dwelling Productions
www.dwellingproductions.com