[Solar-talk] UI Widgets
Paul M Jones
pmjones at solarphp.com
Thu Jul 20 11:25:22 PDT 2006
On Jul 20, 2006, at 12:34 PM, Rodrigo Moraes wrote:
> On 7/18/06, Paul M Jones wrote:
>> I am interested in this too; as you said earlier, having a set of
>> Solar_View_Helper classes for these kinds of things would be
>> fantastic. I wouldn't call them "widgets" exactly, but I know what
>> you mean. (Let's not forget "tables" and "grids". ;-)
>
> Ok, another name is needed and some concept definitions. From
> Wikipedia:
>
> Widget: "A widget (or control) is an interface component that a
> computer user interacts with" [...]
>
> Widget toolkits: "Widget toolkits (or GUI toolkits) are sets of basic
> building units for graphical user interfaces."
>
> In Solar words, I think the Widget toolkits are the View helpers.
Yes, this sounds accurate.
> I wonder if widgets need to be separated or
> put under helper folders?
I would think they'd be helpers, the same as any other helper ...
just with more functionality built in, perhaps as a combination of
other classes and helpers.
> For example, I need a widget right now - a
> "pagination navbar". There is no pagination library in Solar, so it
> will be a helper that wraps Pear::Pager. Let's see how it can use
> other helpers to be built. Thoughts welcome!
There's no separate Pager class, but paging support is built in to
Solar_Sql_Select; you can setPaging($num_of_rows) and limitPage
($page_num) to get a specific page. Once you build a query with it,
you can call countPages() to get an array with keys 'count' (number
of rows total) and 'pages' (count/rows_per_page). The only thing
left is to have a helper that shows some nice HREFs; it might take
$num_pages, $current_page, and a base HREF that gets appended with
the proper page number in a loop.
--
Paul M. Jones <http://paul-m-jones.com>
Solar: Simple Object Library and Application Repository
for PHP5. <http://solarphp.com>
Savant: The simple, elegant, and powerful solution for
templates in PHP. <http://phpsavant.com>
More information about the solar-talk
mailing list