View previous topic :: View next topic |
Author |
Message |
kills Smarty Elite
Joined: 28 May 2004 Posts: 493
|
Posted: Wed Oct 06, 2004 5:44 pm Post subject: SmartyPaginate feature Request |
|
|
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 |
|
mohrt Administrator
Joined: 16 Apr 2003 Posts: 7368 Location: Lincoln Nebraska, USA
|
Posted: Wed Oct 06, 2004 6:40 pm Post subject: |
|
|
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 |
|
Back to top |
|
mohrt Administrator
Joined: 16 Apr 2003 Posts: 7368 Location: Lincoln Nebraska, USA
|
Posted: Wed Oct 06, 2004 7:17 pm Post subject: |
|
|
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 |
|
kills Smarty Elite
Joined: 28 May 2004 Posts: 493
|
Posted: Wed Oct 06, 2004 7:36 pm Post subject: |
|
|
thanks you are so nice !
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 |
|
mohrt Administrator
Joined: 16 Apr 2003 Posts: 7368 Location: Lincoln Nebraska, USA
|
Posted: Wed Oct 06, 2004 7:52 pm Post subject: |
|
|
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
Monte |
|
Back to top |
|
kills Smarty Elite
Joined: 28 May 2004 Posts: 493
|
Posted: Wed Oct 06, 2004 7:53 pm Post subject: |
|
|
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
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
------------
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 |
|
mohrt Administrator
Joined: 16 Apr 2003 Posts: 7368 Location: Lincoln Nebraska, USA
|
Posted: Wed Oct 06, 2004 8:03 pm Post subject: |
|
|
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 |
|
mohrt Administrator
Joined: 16 Apr 2003 Posts: 7368 Location: Lincoln Nebraska, USA
|
Posted: Wed Oct 06, 2004 8:06 pm Post subject: |
|
|
Are you saying that the "next" link shows up even when there is nothing "next" to go to? |
|
Back to top |
|
kills Smarty Elite
Joined: 28 May 2004 Posts: 493
|
Posted: Wed Oct 06, 2004 8:18 pm Post subject: |
|
|
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?
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 |
|
mohrt Administrator
Joined: 16 Apr 2003 Posts: 7368 Location: Lincoln Nebraska, USA
|
Posted: Wed Oct 06, 2004 8:27 pm Post subject: |
|
|
I looked at the example, but its hard to determine without seeing the code
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 |
|
kills Smarty Elite
Joined: 28 May 2004 Posts: 493
|
Posted: Wed Oct 06, 2004 8:39 pm Post subject: |
|
|
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 |
|
|