[Catalyst] Re: OT: Better TT pager?
kakimoto at tpg.com.au
kakimoto at tpg.com.au
Sun Jun 21 05:16:17 GMT 2009
Hi, all,
Looked at J. Rockway's Catalyst book (page 69) and although there were
some typo errors( ie. c.req was represented as c.res in the final
paragraph ), I got it working in that I just had to make the parameters
to c.req.uri_with as hash references instead of just hashes.
Thanks
K. akimoto
On Sun, Jun 21st, 2009 at 2:37 PM, kakimoto at tpg.com.au wrote:
> Hi, there, Oliver and everyone:)
>
> Thanks for your posting:)
> Referring to
> http://www.mail-archive.com/catalyst@lists.scsys.co.uk/msg05232.html,
> I
> adopted the code given into my template and it looks really good but
> the
> hyperlink doesn't have any value. I suppose it's because [%
> c.req.uri_with(...) %] is not defined.
>
> 1)why is the Catalyst request variable being used instead of the
> Catalyst object?
> 2)how can we get the Catalyst request working properly (ie to be
> defined)?
>
>
> thank you :)
>
> K . akimoto
>
>
>
>
> ---------------------
>
> Oliver Charles
> Thu, 22 Jan 2009 07:50:17 -0800
>
> I might as well join in with this :) Here's what we use at work:
>
> [% IF pager %]
> <ul class="paginator">
> <li class="counter">Page [% pager.current_page %] of [%
> pager.last_page %]</li>
> <li><a href="[% c.req.uri_with( page => pager.first_page )
> %]">«</a></li>
> [% IF pager.previous_page %]
> <li><a href="[% c.req.uri_with( page =>
> pager.previous_page ) %]"><</a></li>
> [% END %]
>
> [% start = (pager.current_page - 3) > 0 ? (pager.current_page
> -
> 3) : 1;
> FOREACH page IN [ start .. pager.last_page ] %]
> [% LAST IF loop.count > 6 %]
> <li[% IF pager.current_page == page; ' class="current"';
> END %]>
> <a href="[% c.req.uri_with( page => page ) %]">[%
> page
> %]</a>
> </li>
> [% END %]
>
> [% IF pager.next_page %]
> <li><a href="[% c.req.uri_with( page => pager.next_page
> )
> %]">></a></li>
> [% END %]
> <li><a href="[% c.req.uri_with( page => pager.last_page )
> %]">»</a></li>
> </ul>
> [% END %]
>
> Though my colleague rightly suggested we subclass Data::Page and
> perform the sliding window in there. This shows first page, previous
> page, the current page surrounded by near-by pages. Seems to do the
> job so far!
>
>
> _______________________________________________
> List: Catalyst at lists.scsys.co.uk
> Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
> Searchable archive:
> http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
> Dev site: http://dev.catalyst.perl.org/
>
>
>
More information about the Catalyst
mailing list