PEAR Pager only return first page
| From: | Roger Thomas | Date: | Wed, 26 Jan 2005 03:15:35 +0000 |
| Subject: | PEAR Pager only return first page | ||
| Groups: | php.pear.general | ||
| Request: | Send a blank email to pear-general+get-17161@lists.php.net to get a copy of this message | ||
Hi,
I edited example.php from Pager-2.2.5 to work with Smarty. There's no error but the script only
gave me output for the 1st page. From page2 onwards, I only see the 'Number' table
heading.
-- start of PHP code --
<?php
require_once "smarty/libs/Smarty.class.php";
require_once 'Pager/Pager.php';
//create dummy array of data
$myData = array();
for ($i=0; $i<200; $i++) {
$myData[$i]['number'] = $i;
}
$params = array('itemData' => $myData,
'perPage' => 10,
'delta' => 8,
'append' => true,
'clearIfVoid' => false,
'urlVar' => 'entrant',
'useSessions' => true,
'closeSession' => true,
'mode' => 'Sliding',
);
$pager = & Pager::factory($params);
$page_data = $pager->getPageData();
$links = $pager->getLinks();
$tpl = new Smarty;
$tpl->assign("links",$links['all']);
$tpl->assign("list",$page_data);
$tpl->display("example.tpl");
?>
-- end of php code --
-- start of Smarty template --
{$links}
<br>
<table border=1>
<tr>
<td>Number</td>
</tr>
{section name=example loop=$list}
<tr>
<td>{$list[example].number}</td>
</tr>
{sectionelse}
<tr>
<td>no record</td>
</tr>
{/section}
</table>
-- end of Smarty template --
What could be wrong. I would greatly appreciate some help.
--
Roger
---------------------------------------------------
Sign Up for free Email at http://ureg.home.net.my/
---------------------------------------------------