Smarty Forum Index Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon.

SmartyPaginate feature Request

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> Add-ons
View previous topic :: View next topic  
Author Message
kills
Smarty Elite


Joined: 28 May 2004
Posts: 493

PostPosted: Wed Oct 06, 2004 5:44 pm    Post subject: SmartyPaginate feature Request Reply with quote

Hi all,

im using smartypaginate an i like it! its nice! bit thx to Monte!

Now i have a little feature request.

i think parameter "text" in the function "smarty_function_paginate_prev" and "smarty_function_paginate_next" should be source out to the smartypaginate class. i want to change the prev an next text for the whole page an so i have to add the parameter to each function call in the template. thats really redundant.

i thought about it and i think it would be nice if he seeks first in the parameters list of the function for the text. if theres no text explicitly set he has to seek for the text in the paginate-class. So i can assign the text in a global way.

There should be a way to show the page numbers, too. (Not only the number of the elements which are shown on the current page)
Code:
prev (1) [1-25] (2) [26-50] (3) [51-75] (4) [76-100] next


Also a smarty function which shows the current page and the total pages were a nice idear i think, e.g.
Code:

you are on page { paginate.page } of { paginate.total_pages }


Thx in advance
Back to top
View user's profile Send private message
mohrt
Administrator


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

PostPosted: Wed Oct 06, 2004 6:40 pm    Post subject: Reply with quote

I added the following methods to CVS:

SmartyPaginate::setPrevText('go back');
SmartyPaginate::setNextText('go forward');

This sets the default text for the prev/next links.

Still pondering the other requests Smile
Back to top
View user's profile Send private message Visit poster's website
mohrt
Administrator


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

PostPosted: Wed Oct 06, 2004 7:17 pm    Post subject: Reply with quote

I added the following data to the $paginate var so you can basically "build" your own pagination links instead of using the {paginate_*} helper functions:

* add {$paginate.url}
* add {$paginate.urlvar}
* add {$paginate.current_item}
* add {$paginate.prev_text}
* add {$paginate.next_text}
* add {$paginate.limit}
* add {$paginate.page[N].number}
* add {$paginate.page[N].item_start}
* add {$paginate.page[N].item_end}
* add {$paginate.page[N].is_current}


Give these a try and see if this fills your needs.
Monte
Back to top
View user's profile Send private message Visit poster's website
kills
Smarty Elite


Joined: 28 May 2004
Posts: 493

PostPosted: Wed Oct 06, 2004 7:36 pm    Post subject: Reply with quote

thanks you are so nice Smile!

another request:

what about a parameter for max links to show.

e.g.
Code:

prev [0-4][5-9][10-14] ... next


i think so you can "rotate" over the sites.
only show e.g. 3 Pages, the current and the prev one an the next one.

than if i took the [10-14] link, in the pagination the pagination will look like
[5-9][10-14][15-19] (if the max links is 3).

so you dont get such a huge pagination if you have so much datas to show

do you know what i mean?



--------------------


i got a problem and i dont know how to solve it!

i`ve got a page which show news ( 4news per page), but on the first page if got only 2 overviews and 2 news. So if i`m on the index page ( next = 0) the link dont work korrekt. i tried to set the current Item to -2 but it dont work. How could i solve it?!
Back to top
View user's profile Send private message
mohrt
Administrator


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

PostPosted: Wed Oct 06, 2004 7:52 pm    Post subject: Reply with quote

Yes I have thought about this when originally implementing the class... I have not added this yet. You can build this yourself for the moment though Wink

Monte
Back to top
View user's profile Send private message Visit poster's website
kills
Smarty Elite


Joined: 28 May 2004
Posts: 493

PostPosted: Wed Oct 06, 2004 7:53 pm    Post subject: Reply with quote

mohrt wrote:
Yes I have thought about this when originally implementing the class... I have not added this yet. You can build this yourself for the moment though Wink

Monte


its only a request.
In the moment i dont have the need for it.
but if i have little time i will do it Smile

------------

Do you have an idear how to solve the problem i described in the last post?

@see http://www.st-carstyling.de/temp/
Back to top
View user's profile Send private message
mohrt
Administrator


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

PostPosted: Wed Oct 06, 2004 8:03 pm    Post subject: Reply with quote

kills wrote:

i got a problem and i dont know how to solve it!

i`ve got a page which show news ( 4news per page), but on the first page if got only 2 overviews and 2 news. So if i`m on the index page ( next = 0) the link dont work korrekt. i tried to set the current Item to -2 but it dont work. How could i solve it?!


I'm not sure I understand the problem, can you mock up an example, maybe example data so I can replicate the problem?
Back to top
View user's profile Send private message Visit poster's website
mohrt
Administrator


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

PostPosted: Wed Oct 06, 2004 8:06 pm    Post subject: Reply with quote

Are you saying that the "next" link shows up even when there is nothing "next" to go to?
Back to top
View user's profile Send private message Visit poster's website
kills
Smarty Elite


Joined: 28 May 2004
Posts: 493

PostPosted: Wed Oct 06, 2004 8:18 pm    Post subject: Reply with quote

mohrt wrote:
Are you saying that the "next" link shows up even when there is nothing "next" to go to?


did you take a look on the link?

kills wrote:

Do you have an idear how to solve the problem i described in the last post?

@see http://www.st-carstyling.de/temp/


on the first page there are 2 overviews and only 2 news.
on all other pages i want to have 4 news and no overviews.

if i click the first link which is generated by the pagination tool i`m only getting the 2nd , 3rd, 4th, 5th article instead of 1st, 2nd, 3rd, 4th.

i think the only problem is, that on the first link the parameter "start" has the value "1" instead of "0".

i will try later If the next link works correct.
Back to top
View user's profile Send private message
mohrt
Administrator


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

PostPosted: Wed Oct 06, 2004 8:27 pm    Post subject: Reply with quote

I looked at the example, but its hard to determine without seeing the code Smile

If you are getting 2-5 when you want 1-4, then I'm guessing that you aren't using the variables correctly.

Using a database query with "LIMIT X,Y", you would use SmartyPaginate::getCurrentItem for "X" and SmartyPaginate::getLimit() for "Y".

Using an array (with a starting index of zero), you would use SmartyPaginate::getCurrentItem - 1 for the starting element, and SmartyPaginate::getLimit() for the ending element. Maybe that is your problem, not using - 1 with a zero-indexed array?
Back to top
View user's profile Send private message Visit poster's website
kills
Smarty Elite


Joined: 28 May 2004
Posts: 493

PostPosted: Wed Oct 06, 2004 8:39 pm    Post subject: Reply with quote

mohrt wrote:

Using a database query with "LIMIT X,Y", you would use SmartyPaginate::getCurrentItem for "X" and SmartyPaginate::getLimit() for "Y".


year im using those querys

mohrt wrote:

Using an array (with a starting index of zero), you would use SmartyPaginate::getCurrentItem - 1 for the starting element, and SmartyPaginate::getLimit() for the ending element. Maybe that is your problem, not using - 1 with a zero-indexed array?


thats it !! thanks!!!
Back to top
View user's profile Send private message
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    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