CHG: Added documentation for Doctrine_Pager and Doctrine_Pager_Range* classes TODO: Finish pagination documentation
34 lines
850 B
Plaintext
34 lines
850 B
Plaintext
TBD
|
|
|
|
Basic pager layout usage:
|
|
|
|
<code type="php">
|
|
// Creating pager layout
|
|
$pager_layout = new Doctrine_Pager_Layout(
|
|
new Doctrine_Pager(
|
|
Doctrine_Query::create()
|
|
->from( 'User u' )
|
|
->leftJoin( 'u.Group g' )
|
|
->orderby( 'u.username ASC' ),
|
|
$currentPage,
|
|
$resultsPerPage
|
|
),
|
|
new Doctrine_Pager_Range_Sliding(array(
|
|
'chunk' => 5
|
|
)),
|
|
'http://wwww.domain.com/app/User/list/page,{%page}'
|
|
);
|
|
|
|
// Assigning templates for page links creation
|
|
$pager_layout->setTemplate('[<a href="{%url}">{%page}</a>]');
|
|
$pager_layout->setSelectedTemplate('[{%page}]');
|
|
|
|
// Retireving Doctrine_Pager instance
|
|
$pager = $pager_layout->getPager();
|
|
|
|
// Fetching users
|
|
$users = $pager->execute();
|
|
|
|
// Displaying page links
|
|
echo $pager_layout->display();
|
|
</code> |