Re: AW: [SMARTY] Paging
| From: | Robert Amos | Date: | Thu, 12 Dec 2002 11:33:36 +0000 |
| Subject: | Re: AW: [SMARTY] Paging | ||
| References: | 1 2 3 | Groups: | php.smarty.general |
| Request: | Send a blank email to php-smarty-general+get-6749@lists.php.net to get a copy of this message | ||
if you think about it, its actually alot easier to work out your links in
PHP than it is on your page. then just assign them to the script.
like
$current_page = bleh;
$results_per_page = 20;
$total = count($results);
$pages = ceil($total / $results_per_page);
$firstresult = ($current_page - 1) * $results_per_page;
$lastresult = $firstresult + $results_per_page;
$nextpage = $current_page + 1;
$prevpage = $current_page - 1;
i havent played with this logic for ages, its always just worked for me so
you might have to fiddle a bit.
-bok