[Solar-talk] pager + controller + model + view

Rodrigo Moraes rodrigo.moraes at gmail.com
Wed Jul 4 12:52:23 CDT 2007


2007/7/3, Jeff Surgeson:
> In my controller....
> // Set the pager info using the defaults.
> $this->_setPager();
>
> // set up fetch query, build where clause,
> // set order page and paging
> $params = array(
>         'where'         => $where,
>         'order'         => $order,
>         'page'          => $this->layout_pager['page'],
>         'paging'        => $this->layout_pager['paging'],
> );
>
> // get count of pages
> $total = $this->_products->countPages($params);
> $this->layout_pager['count'] = $total['count'];

And now seeing that you are using an array for the pager data in your
controller, I'm thinking seriously to make the pager helper receive an
array with pager specs.

It would be possible to make it work with 'pages' or 'count'; the
later would be preferable but if 'pages' was passed we could guess the
items count more or less. Also it would be very simple to output the
pager: echo $this->pager()->fetch($href, $this->layout_pager). What do
you think?

-- rodrigo


More information about the Solar-talk mailing list