Smarty Forum Index Smarty
The discussions here are for Smarty, a template engine for the PHP programming language.

SmartyPaginate last page problem

 
Post new topic   Reply to topic    Smarty Forum Index -> Feature Requests
View previous topic :: View next topic  
Author Message
ladislav2
Smarty n00b


Joined: 05 Sep 2007
Posts: 1

PostPosted: Wed Sep 05, 2007 10:52 am    Post subject: SmartyPaginate last page problem Reply with quote

Hi,

I need to fix one issue in Paginate plugin. Let's say I have 2 pages.
[1-20][21-40]. If I access /index.php?next=100 (so the "next" argument is much higher than the "next" argument of the last page) it DOES NOT redirect browser to the last page, but gives no results at all. How can I achieve this ? Pls,

thank you.
Back to top
View user's profile Send private message
mohrt
Administrator


Joined: 16 Apr 2003
Posts: 7368
Location: Lincoln Nebraska, USA

PostPosted: Wed Sep 05, 2007 1:36 pm    Post subject: Reply with quote

Do that in your PHP: test if $next > $total, then set $next = $total.
Back to top
View user's profile Send private message Visit poster's website
kills
Smarty Elite


Joined: 28 May 2004
Posts: 493

PostPosted: Fri Sep 07, 2007 7:42 am    Post subject: Reply with quote

why dont do it in smarty paginate itself?
Back to top
View user's profile Send private message
mohrt
Administrator


Joined: 16 Apr 2003
Posts: 7368
Location: Lincoln Nebraska, USA

PostPosted: Fri Sep 07, 2007 1:24 pm    Post subject: Reply with quote

Normally there is no need to. If you use the links generated by SmartyPaginate, there should never be a next link bigger than the overall total.
Back to top
View user's profile Send private message Visit poster's website
kills
Smarty Elite


Joined: 28 May 2004
Posts: 493

PostPosted: Mon Sep 17, 2007 2:11 pm    Post subject: Reply with quote

but if a user alters the url by purpose this is something which should be checked by smarty paginate in my opinion
Back to top
View user's profile Send private message
mohrt
Administrator


Joined: 16 Apr 2003
Posts: 7368
Location: Lincoln Nebraska, USA

PostPosted: Mon Sep 17, 2007 3:58 pm    Post subject: Reply with quote

Any and all input from the user should be given a sanity check. SmartyPaginate shouldn't have to guess at what to do with invalid information. This is only one example, there are plenty of other URL vars that can cause problems if adjusted and not checked.
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    Smarty Forum Index -> Feature Requests All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group
Protected by Anti-Spam ACP