[Solar-talk] pager + controller + model + view
Paul M Jones
pmjones at ciaweb.net
Wed Jul 11 09:26:25 CDT 2007
On Jul 2, 2007, at 12:50 PM, Rodrigo Moraes wrote:
> Let me share a solution to make controller, model and view walk
> together regarding pagination. It's also a suggestion for
> Solar_App_Base, or just take it as an idea to integrate well how
> controllers request data from models and at the same time tell the
> view about paging, page, etc.
Paging is a common-enough operation that it might be OK to make
allowances for it in Solar_App_Base. Good idea Rodrigo. :-)
Now for some feedback:
> App_Base pager property:
> * $layout_pager: array with pager values ('page', 'paging', 'count')
Would this necessarily be a "layout" element? It seems to me that
paging is a function of the view, not of the layout. We have
$controller and $action, perhaps adding $pager is in line with that.
(Although I can see an argument for the pager as part of the
navigation system.)
Also, I think instead of 'count' it ought to be 'total' and 'pages',
so that it maps more closely to the fetchCount() array return.
That would end up looking something like:
$this->pager = array(
'total' => 100,
'pages' => 20,
'page' => 1,
'paging' => 5,
);
As you note later, the pager helper should take this array as its
parameter.
> App_Base pager method:
> * _setPager():
I don't think I'm ready to commit to a method for this in
Solar_App_Base yet ...
> The_setPager() method is defined in this class:
> [1] http://dev.tipos.org/browser/trunk/Tipos/App/Base.php
... and I don't see it there anyway; did I miss it?
--
Paul M. Jones <http://paul-m-jones.com>
Solar: Simple Object Library and Application Repository
for PHP5. <http://solarphp.com>
Join the Solar community wiki! <http://solarphp.org>
Savant: The simple, elegant, and powerful solution for
templates in PHP. <http://phpsavant.com>
More information about the Solar-talk
mailing list