but it doesn't work yet
<pre>
public function indexAction()
{
$model = $this->_getModel();
$adapter = new
Zend_Paginator_Adapter_DbSelect($model->fetchAllToPaginator());
$paginator = new Zend_Paginator($adapter);
var_dump($this->_getParam('page',1));
$paginator->setCurrentPageNumber($this->_getParam('page',1));
//$paginator->setItemCountPerPage('1');
$this->view->paginator = $paginator;
}
</pre>
If I get rid of the comment
on $paginator->setItemCountPerPage('1');
it works fine.
whisher wrote:
>
> Hi.
> May be I'm wrong but with
> this code I get Warning: Division by zero in library/Zend/Paginator.php
> on line 995
> <pre>
> public function indexAction()
> {
> $model = $this->_getModel();
> $adapter = new
> Zend_Paginator_Adapter_DbSelect($model->fetchAllToPaginator());
> $paginator = new Zend_Paginator($adapter);
> $paginator->setCurrentPageNumber('0');
> //$paginator->setItemCountPerPage('10');
> var_dump(count($paginator));
> // $paginator->setCurrentPageNumber('0');
> //$this->view->articles = $paginator;
> }
> </pre>
> <p>Zend_Paginator on line 995</p>
> <pre>
> protected function _calculatePageCount()
> { var_dump($this->_itemCountPerPage);// NULL
> return (integer) ceil($this->_adapter->count() /
> $this->_itemCountPerPage);
> }
> </pre>
>
> <p>from the reference</p>
>
> <p>setItemCountPerPage | Sets the maximum number of items to display on a
> page (default 10).</p>
>
>
> <p>so I don't see the point :(</p>
>
>
> <p>What's the trouble ?</p>
>
> <p>Bye</p>
>
--
View this message in context: http://www.nabble.com/Zend_Paginator_Adapter_DbSelect-Warning%3A-Division-by-zero-tp24847975p24848696.html
Sent from the Zend DB mailing list archive at Nabble.com.
没有评论:
发表评论