0

我正在尝试使用 zend 框架 1.1 进行分页,但无法使其工作。我看过不同的教程,但它对我来说太离谱了..这是我的控制器:

public function indexAction()
{
  $db=new Application_Model_DbTable_Database();
  $sql=$db->fetch_records();


  $paginator=new Zend_Paginator(new  Zend_Paginator_Adapter_Array($sql));
  $paginator->setItemCountPerPage(3);
  $paginator->setCurrentPageNumber($this->_getParam('page',1));
  $this->view->paginator=$paginator;
}

然后我有这个视图脚本:

foreach($this->paginator as $book) 
{
     echo $book['firstname'].''.$book['lastname'];
     echo "<br>";
 }

 echo $this->paginationcontrol($this->paginator,'Sliding','pagination.phtml');

我可以看到前 3 条记录,但是当我添加分页控件时出现错误。pagination.phtml 文件位于脚本目录中我得到的错误是

an error just occurred, application error

我究竟做错了什么?

4

0 回答 0