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

Pagination issue with existing query string.

 
Post new topic   Reply to topic    Smarty Forum Index -> Add-ons
View previous topic :: View next topic  
Author Message
monotreme
Smarty Regular


Joined: 22 Feb 2004
Posts: 97
Location: USA

PostPosted: Tue Apr 01, 2008 5:25 am    Post subject: Pagination issue with existing query string. Reply with quote

The first time I tried Smarthy Paginate it worked like a champ. Because the page was a default, o sea, it doesn't have a query string to generate it, it is just

http://mydomain.com/bla.php

So when you want to page forward the smartypaginate will gerate for you

http://mydomain.com/bla.php?next=26 and it is all wunderbar.

OK well now I have this page and to generate it you say

http://mydomain.com/report.php?rep=customer

The first page works fine but when you wish to go forward one page it generates

http://mydomain.com/report.php?next=26 and it goes to the white screen of death because report require a rep parameter. How can I get it to append next=26 to the existing uri sorry it don't really say how to do that anywheres. I will try URI instead of SELF for setting the URL. just a thought,.. BRB
_________________
Your online 24/7 box office
http://www.tixrus.us
Back to top
View user's profile Send private message Visit poster's website
monotreme
Smarty Regular


Joined: 22 Feb 2004
Posts: 97
Location: USA

PostPosted: Tue Apr 01, 2008 5:29 am    Post subject: bingo Reply with quote

that seem to have worked.
Monotreme is one hell of a problem solver.
_________________
Your online 24/7 box office
http://www.tixrus.us
Back to top
View user's profile Send private message Visit poster's website
monotreme
Smarty Regular


Joined: 22 Feb 2004
Posts: 97
Location: USA

PostPosted: Tue Apr 01, 2008 5:35 am    Post subject: only one teensy little problem. Reply with quote

FIrst time URI is bla.php?rep=cust, and so Paginate append next=26.
OK next time next=26 is part of URI so the new one is bla.php?rep=cust&next=26&next=51
it still works because the later one overwrites the first one. Now supose you want to go back it takes the whole URI and append again bla.php?rep=cust&next=26&next=51&next=26

eventually you exceed the length of the query string.

back to drawing board. I have to get the query string separate and filter out any next but leave the rest.

I suppose this is all documented some place, eh?
_________________
Your online 24/7 box office
http://www.tixrus.us
Back to top
View user's profile Send private message Visit poster's website
Celeb
Administrator


Joined: 17 Apr 2007
Posts: 1025
Location: Vienna

PostPosted: Wed Apr 02, 2008 10:54 am    Post subject: Reply with quote

I came across this problem as I first used SmartyPaginate aswell.
I solved it by simply removing the next variables from the querystring.
Code:
      $url = $_SERVER['REQUEST_URI'];
      $pattern = "/\&next=\d+/";
      $url = preg_replace($pattern,"",$url);

      // Set the url for the pagination links
      SmartyPaginate::setUrl   ($url);

_________________
Darn computers always do what I tell them to instead of what I want them to do.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Smarty Forum Index -> Add-ons 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