Soon there’ll be more doc in here, for now you can read stuff at my blog
PLEASE NOTE that this component MAY NOT WORK AS EXPECTED with ZF 1.5 and / or 1.0.4. It has not been tested, and due to emerging alternative paginating solutions for the Zend Framework, I may consider discontinuing this component developement (although the decision as not yet been taken, and a port to 1.5 is in progress).
Basically, the pagination component wraps up around a Zend_Db_Table object overloading !fetchAll to add the offset and count arguments. !fetchAll then returns a Riskle_Db_Table_Rowset_Paginate object which can be used in conjunction with the Riskle_View_Helper_Paginate class to display navigation informations.
You will need some components from the Riskle namespace in order to be able to use this pagination component. Luckily, every needed file is included into the distribution archive. For information, the archive tree looks like this:
.
|-- LICENSE
`-- library
`-- Riskle
|-- Db
| |-- Table
| | |-- Abstract.php
| | |-- Exception.php
| | |-- Paginate
| | | `-- Exception.php
| | |-- Paginate.php
| | `-- Rowset
| | `-- Paginate.php
| `-- Table.php
|-- Pattern
| |-- Proxy
| | `-- Exception.php
| `-- Proxy.php
`-- View
`-- Helper
`-- Paginate.php
See also:
In your bootstrap, you need to register the riskle view helper namespace:
$view = new Zend_View;
$view->setHelperPath('Riskle/View/Helper', 'Riskle_View_Helper');
Zend_Controller_Action_HelperBroker::getStaticHelper('ViewRenderer')->view = $view;
In the controller:
require_once 'models/Table.php';
$table = new Riskle_Db_Table_Paginate(new Table, $page); // Table is a class extending Riskle_Db_Table
$this->view->assign('rowset', $table->fetchAll($where)); // !fetchAll's signature is unmodified
In the view:
<?php $this->paginate($this->rowset); // initializes the helper ?>
<div id="navigation"><?php
echo $this->paginate()->previous(); // displays a "previous link" if available
echo $this->paginate()->navigation(); // displays the list of pages
echo $this->paginate()->next(); // displays a "next link" if available
?></div>
You can always find the latest version of the paginate component on the files area of this space or on the subversion repository (be sure to checkout all required components if using svn).
Some of errors I experienced:
* Zend_Db_Select_Exception: Invalid token ':schema' given in /srv/trunk/lib/Zend/Db/Select.php on line 811
* Strict standards: Declaration of Riskle_Db_Table_Abstract::find() should be compatible with that of Zend_Db_Table_Abstract::find() in /srv/trunk/lib/Riskle/Db/Table/Abstract.php on line 336
Hi, i try to use your component but i received an error like this:
Fatal error: Class 'Table' not found in C:\wamp2\www\iprahidromasajes\app\controllers\ProductosController.php on line 14
Hi, I just downloaded the paginate package. Do you have a working example of the paginate package? I set it up using but I cannot seem to get it to work. BTW, I have the following:
bootstrapper:
require_once 'Riskle/Db/Table.php'
$view = new Zend_View;
$view->setHelperPath( './library/Riskle/View/Helper', 'Riskle_View_Helper');
Zend_Controller_Action_HelperBroker::getStaticHelper('ViewRenderer')->view = $view;
controller:
$table = new Riskle_Db_Table_Paginate(new Episode, $this->_getParam('page')); // Table is a class extending Riskle_Db_Table
$orderBy = "created_at DESC";
$this->view->assign('rowset', $table->fetchAll(null, $orderBy)); // fetchAll's signature is unmodified
view:
<?php $this->paginate($this->rowset); // initializes the helper ?>
<div id="navigation">
<?php
echo $this->paginate()->previous(); // displays a "previous link" if available
echo $this->paginate()->navigation(); // displays the list of pages
echo $this->paginate()->next(); // displays a "next link" if available
?>
</div>
Is there something that I'm missing?
Thanks in advance,
-Conrad
I'm new in this field, and I tried to follow the above steps but I obtained an error, and I have now idea what's wrong:
Strict Standards: Declaration of Riskle_Db_Table_Abstract::find() should be compatible with that of Zend_Db_Table_Abstract::find() in C:\Program Files\EasyPHP 2.0b1\www\zendtut\gettingstarted\library\Riskle\Db\Table\Abstract.php on line 336
Fatal error: Uncaught exception 'Zend_View_Exception' with message 'helper 'paginate' not found in path' in C:\Program Files\EasyPHP 2.0b1\www\zendtut\gettingstarted\library\Zend\View\Abstract.php:1003 Stack trace: #0 C:\Program Files\EasyPHP 2.0b1\www\zendtut\gettingstarted\library\Zend\View\Abstract.php(496): Zend_View_Abstract->_loadClass('helper', 'paginate') #1 C:\Program Files\EasyPHP 2.0b1\www\zendtut\gettingstarted\library\Zend\View\Abstract.php(298): Zend_View_Abstract->getHelper('paginate') #2 [internal function]: Zend_View_Abstract->__call('paginate', Array) #3 C:\Program Files\EasyPHP 2.0b1\www\zendtut\gettingstarted\application\views\scripts\index\index.phtml(6): Zend_View->paginate(Object(Riskle_Db_Table_Rowset_Paginate)) #4 C:\Program Files\EasyPHP 2.0b1\www\zendtut\gettingstarted\library\Zend\View.php(46): include('C:\Program File...') #5 C:\Program Files\EasyPHP 2.0b1\www\zendtut\gettingstarted\library\Zend\View\Abstract.php(768): Zend_View->_run('.\application\v...') #6 C:\Program Files\EasyPHP 2.0b1\www in C:\Program Files\EasyPHP 2.0b1\www\zendtut\gettingstarted\library\Zend\View\Abstract.php on line 1003
I used r122 version
It give me an error about missing an exception file.
Hi,
I have just installed this Pagination Component. But I can't get it to work.
It's giving the following errors:
Strict Standards: Declaration of Riskle_Db_Table_Abstract::find() should be compatible with that of Zend_Db_Table_Abstract::find() in C:\wamp\www\tellydb\library\Riskle\Db\Table\Abstract.php on line 336
Strict Standards: Declaration of Riskle_Db_Table_Abstract::_fetch() should be compatible with that of Zend_Db_Table_Abstract::_fetch() in C:\wamp\www\tellydb\library\Riskle\Db\Table\Abstract.php on line 336
Fatal error: Class 'Zend_Db_Select_Exception' not found in C:\wamp\www\tellydb\library\Zend\Db\Select.php on line 811
I checked the definitions of find and _fetch methods in Riskle_Db_Table_Abstract and Zend_Db_Table_Abstract.
Signatures from Riskle_Db_Table_Abstract are :
-- public function find($key) {
-- protected function _fetch($where = null, $order = null, $count = null, $offset = null, $cols = null, $selectParentFields = true)
And from Zend_Db_Table_Abstract are:
-- public function find()
-- protected function _fetch(Zend_Db_Table_Select $select)
Why are those defined in Riskle are different from those in Zend??
Please help me out !!
Thanks in advance,
Prasad K