|
Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon. |
|
View previous topic :: View next topic |
Author |
Message |
ladislav2 Smarty n00b
Joined: 05 Sep 2007 Posts: 1
|
Posted: Wed Sep 05, 2007 10:52 am Post subject: SmartyPaginate last page problem |
|
|
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 |
|
mohrt Administrator
Joined: 16 Apr 2003 Posts: 7368 Location: Lincoln Nebraska, USA
|
Posted: Wed Sep 05, 2007 1:36 pm Post subject: |
|
|
Do that in your PHP: test if $next > $total, then set $next = $total. |
|
Back to top |
|
kills Smarty Elite
Joined: 28 May 2004 Posts: 493
|
Posted: Fri Sep 07, 2007 7:42 am Post subject: |
|
|
why dont do it in smarty paginate itself? |
|
Back to top |
|
mohrt Administrator
Joined: 16 Apr 2003 Posts: 7368 Location: Lincoln Nebraska, USA
|
Posted: Fri Sep 07, 2007 1:24 pm Post subject: |
|
|
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 |
|
kills Smarty Elite
Joined: 28 May 2004 Posts: 493
|
Posted: Mon Sep 17, 2007 2:11 pm Post subject: |
|
|
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 |
|
mohrt Administrator
Joined: 16 Apr 2003 Posts: 7368 Location: Lincoln Nebraska, USA
|
Posted: Mon Sep 17, 2007 3:58 pm Post subject: |
|
|
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 |
|
|
|
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
|