Pagination Component
Soon there’ll be more doc in here, for now you can read stuff at my blog
Theory of operation
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.
Requirements
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:
.
|-- LICENCE
`-- 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:
Usage
In the controller:
require_once 'models/Table.php';
$table = new Riskle_Db_Table_Paginate(new Table); // Table is a class extending Zend_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>
Download
You can always find the latest version of the paginate component on the files area of this space