我正在做一个 symfony 项目,需要为长列表创建一个分页系统。我使用 sfPropelPager 插件来生成它们。我这样使用它:
我用不同的标签打印所有页面,<div>
并且只设置第一个可见。然后使用 javascript 函数,我在单击下一个、上一个、... 按钮时显示其他页面。
我用来生成页面的功能是:`
$pager = new sfPropelPager('SysLogTbl',sfConfig::get('sfPropelPagerLines'));
$c = new Criteria();
$c->add('codigo_maestro',$this->getCodigoMaestro());
$c->add('codigo_registro',$id);
$c->addDescendingOrderByColumn('fecha_log');
$pager->setCriteria($c);
$pager->init();
return $pager;`
视图代码是:
foreach($pager->getLinks() as $page){
echo'<div id="logpage'.$page.'" class="logpages" style="width:100%;';
if($page!=1){echo ' display:none';}
echo '">';
$pager->setPage($page);
$pager->init();
$results= $pager->getResults();
echo '<table class="none_list" id="list">';
echo "<thead>";
echo "<td width='8%'>Usuario</td><td width='8%'>Acción</td>";
echo "<td width='13%'>Campo</td><td width='25%'>Valor Antiguo</td>";
echo"<td width='25%'>Nuevo valor</td><td width='21%'>TimeStamp</td>";
echo "</thead>";
foreach($results as $log){
echo '<tr id="'.$log->getCodigoLog().'" >';
< here goes each entry in the page display, not relevant >
}
echo '</table>';
echo "<div style='float:left'>";
echo image_tag('first.png',array('class'=>"first"));
echo image_tag('previous.png',array('class'=>"previous"));
echo "</div>";
foreach($lista->getLinks() as $page){
echo "<div class='logindex' id='".$page."' style='float:left; cursor:pointer'>";
if($page == $lista->getPage()){
echo "<b>".$page."</b>";
}else{
echo $page;
}
echo "</div>";
}
echo image_tag('next.png',array('class'=>"next"));
echo image_tag('last.png',array('class'=>"last"));
echo '</div>';
$lista->setCursor($lista->getNextPage());
}
$lista->setCursor($lista->getFirstPage());?>
问题是 sfPropelPager 最多只能生成 5 个页面。
你知道我必须在哪里配置它才能显示所有页面吗?谢谢你!