Example #1
0
 public function render($columns = array())
 {
     if ($columns) {
         $this->columns = $columns;
     }
     $link = new A_Pagination_Helper_Link($this->pager, $this->url);
     $links = array();
     foreach ($this->columns as $column => $label) {
         $links[] = $column ? $link->order($column, $label) : $label;
     }
     return implode($this->separator, $links);
 }
$pager->setRangeSize(3)->process($_GET);
// create a new link helper
$link = new A_Pagination_Helper_Link($pager);
// retrieve items on current page
$rows = $pager->getItems();
// create links using helper directly
$links = '';
$links .= $link->previous('Previous');
$links .= $link->first();
$links .= $link->range();
$links .= $link->last();
$links .= $link->next('Next');
// display the data
echo "<div>{$links}</div>";
echo '<table border="1">';
echo '<tr><th>' . $link->order('', 'Row') . '</th><th>' . $link->order('title', 'Title') . '</th><th>' . $link->order('month', 'Month') . '</th></tr>';
$n = 1;
foreach ($rows as $value) {
    echo '<tr>';
    echo '<td>' . $n++ . '.</td><td>' . $value['title'] . '</td><td>' . $value['month'] . '</td>';
    echo '</tr>';
}
echo '</table>';
echo "<div>{$links}</div>";
?>
<p/>
<a href="../">Return to Examples</a>
</p>

</body>
</html>