[cgiapp] Q: Any guidelines for paging thru db records via CGI
params?
Cees Hek
ceeshek at gmail.com
Mon May 26 17:53:25 EDT 2008
On Mon, May 26, 2008 at 11:56 PM, Michael Lackhoff
<lackhoff at zbmed.uni-koeln.de> wrote:
> On 26 May 2008 at 23:13, Cees Hek wrote:
>
> Many thanks Cees, I think that should get me going. The only missing
> part is -- well, the plugin. Or did I miss something? At least I didn't
> see an attachment or link.
I need to clean up a few things before I can publish it publically.
>> So from the template above you can see that the pager object has at
>> least the following methods:
>
> what do you mean by "at least"? Because it is work in progress or is
> there some modular system within your plugin?
I didn't actually look at the plugin source when writing my examples
:) There may be a couple other helper methods that were not used in
my example, but I don't remember off hand.
>> page
>> last_page
>> next_page
>> previous_page
>> on_first_page
>> on_last_page
>> url
>> formurl
>> hidden_params
>>
>> Most of those are self explanatory. The url method is (IMHO) the best
>> part, since you don't have to worry about building URLs yourself. It
>
> I already have a url method in my base class. I use it to build a URL
> that is both pretty and what CAP::Dispatch expects, e.g. I feed
> (customers, edit, 342) to it and get
> 'http://myserver/customers/edit/342' back (looks trivial but also
> handles lots of variants). I am not sure yet how to best avoid a naming
> conflict but there will be ways.
There will be no conflict. The plugin only exports one method called
'pager'. When you call the pager method, it returns an object, and
the object has all of the above methods.
I have a URL method in my base class that does similar things as well.
But the pager plugin doesn't need to know about this, because it is
only making very simple changes to the existing URL that was called.
All it is doing is taking the current URL and changing the 'page'
parameter. This would only be a problem if the page parameter is part
of the path_info, instead of being a query param.
Cheers,
Cees
More information about the cgiapp
mailing list