1
0
mirror of synced 2024-12-15 23:56:02 +03:00
doctrine2/manual/docs/en/utilities/pagination/customizing-pager-layout.txt
2007-12-22 19:00:58 +00:00

64 lines
1.5 KiB
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

TBD
Basic customization to generate this page links generation:
« 1 2 3 4 5 »
<code type="php">
class PagerLayout extends Doctrine_Pager_Layout
{
public function initialize()
{
}
public function display($options = array(), $return = false)
{
$str = '';
// First page
$options['page_number'] = $this->getPager()->getFirstPage();
$options['page'] = '&laquo;';
$options['url'] = $this->_parseUrl($options);
$str .= $this->_parseTemplate($options);
// Previous page
$options['page_number'] = $this->getPager()->getPreviousPage();
$options['page'] = '&lsaquo;';
$options['url'] = $this->_parseUrl($options);
$str .= $this->_parseTemplate($options);
// Current chunk
// Removing page, page_mask and url
unset($options['page']);
unset($options['page_text']);
unset($options['url']);
$str .= parent::display($options, true);
// Next page
$options['page_number'] = $this->getPager()->getNextPage();
$options['page'] = '&rsaquo;';
$options['url'] = $this->_parseUrl($options);
$str .= $this->_parseTemplate($options);
// Last page
$options['page_number'] = $this->getPager()->getLastPage();
$options['page'] = '&raquo;';
$options['url'] = $this->_parseUrl($options);
$str .= $this->_parseTemplate($options);
// Possible wish to return value instead of print it on screen
if ($return) {
return $str;
}
echo $str;
}
}
</code>