go to Last page in a prev/next list
2 posts by 2 authors in: Forums > CMS Builder
Last Post: March 11, 2010 (RSS)
By s2smedia - March 10, 2010
How can I add a link to the Prev/NExt page links that will take you to the last page?
Re: [s2smedia] go to Last page in a prev/next list
By Chris - March 11, 2010
Hi s2smedia,
The simplest answer is:
where recordMetaData (in red above) is the name of your meta data variable you get from getRecords().
There are some more complicated setups which may require you to pass forward existing query string arguments. If this is the case, you can do:
I hope this helps. Please let me know if you have any questions.
The simplest answer is:
<a href="?page=<?php echo $recordMetaData['totalPages'] ?>">last page</a>
where recordMetaData (in red above) is the name of your meta data variable you get from getRecords().
There are some more complicated setups which may require you to pass forward existing query string arguments. If this is the case, you can do:
<?php
$extraQueryArgs = '';
foreach ($_REQUEST as $key => $value) {
if ($key == 'page') { continue; } // skip page value, we set it below
if (is_array($value)) { continue; } // skip multi value php fields
$extraQueryArgs .= urlencode($key) .'='. urlencode($value) . '&';
}
?>
<a href="?<?php echo $extraQueryArgs ?>page=<?php echo $recordMetaData['totalPages'] ?>">last page</a>
I hope this helps. Please let me know if you have any questions.
All the best,
Chris
Chris