Well, this is really trivial isn't it?
On Tuesday, February 18, 2014 3:18:14 PM UTC-7, HittingSmoke wrote:
>
> I followed the pagination tutorial in the web2py book and I have the
> following controller:
>
> def index():
> if len(request.args): page=int(request.args[0])
> else: page=1
> items_per_page=6
> limitby=((page-1)*items_per_page,(page)*items_per_page+1)
> posts=db().select(db.post.ALL, orderby=~db.post.date, limitby=limitby)
> return dict(posts=posts, page=page, items_per_page=items_per_page)
>
> ...and this view controlling navigation:
>
> <div class="pagination pagination-centered">
> <ul>
> {{if page>1:}}
> <li><a href="{{=URL(args=[page-1])}}">Prev</a></li>
> {{pass}}
> {{if len(posts)>items_per_page:}}
> <li><a href="{{=URL(args=[page+1])}}">Next</a></li>
> {{pass}}
> </ul>
> </div>
>
> The only problem I have with it is when you go to the second page it
> reports as page 1. I would like the first page to be page 1. Is that
> possible without completely rewriting the pagination function?
>
--
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
---
You received this message because you are subscribed to the Google Groups
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.