|
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 |
dolphin713 Smarty Rookie
Joined: 14 Jul 2008 Posts: 5
|
Posted: Mon Jul 14, 2008 2:06 pm Post subject: SmartyPaginate conflit |
|
|
Hi,
I have a problem using smartypaginate, that I can´t solve, and need your help.
The problem is due to a page with 2 tables each one having his own pagination. When I press the next page on a table, it influences
the start limit of the other table, and they are supposed to be independent.
So, I have 2 funcionts and a template( with the 2 independent tables), what I´ve done was assigning each table an ID, but it still
doesn´t works.
This is part of my code functions :
Code: |
function getMyProjectTasks(...){
...
SmartyPaginate::reset();
SmartyPaginate::connect('projecttasks');
SmartyPaginate::setLimit($lim,'projecttasks');
SmartyPaginate::setTotal($num,'projecttasks');
$start = SmartyPaginate::getCurrentIndex('projecttasks');
$lim = SmartyPaginate::getLimit('projecttasks');
....
}
function getProjectLog(..){
-----
SmartyPaginate::reset();
SmartyPaginate::connect('projlog');
SmartyPaginate::setLimit($lim,'projlog');
SmartyPaginate::setTotal($num,'projlog');
$start = SmartyPaginate::getCurrentIndex('projlog');
$lim = SmartyPaginate::getLimit('projlog');
.....
}
|
In the page that invokes the template I have
Code: |
SmartyPaginate::assign($template);
|
and in the template I have
Code: |
{paginate_prev id="projecttasks"} {paginate_middle id="projecttasks"} {paginate_next id="projecttasks"}
|
and
Code: |
{paginate_prev id="projlog"} {paginate_middle id="projlog"} {paginate_next id="projlog"}
|
Althought I have assigned an id to each paginated table, they are confliting with each one, I don´t know what else to do, so I´m asking
you help.
Below is some debug data using var_dump($_SESSION['SmartyPaginate']);, before and after pressing a pagination link in table 1
BEFORE :
Code: |
array
'default' =>
array
'item_limit' => int 10
'item_total' => null
'current_item' => int 1
'urlvar' => string 'next' (length=4)
'url' => string '/intranet/intra_plugins/collab/manageproject.php' (length=48)
'prev_text' => string 'prev' (length=4)
'next_text' => string 'next' (length=4)
'first_text' => string 'first' (length=5)
'last_text' => string 'last' (length=4)
'projlog' =>
array
'item_limit' => int 10
'item_total' => int 127
'current_item' => int 1
'urlvar' => string 'next' (length=4)
'url' => string '/intranet/intra_plugins/collab/manageproject.php' (length=48)
'prev_text' => string 'prev' (length=4)
'next_text' => string 'next' (length=4)
'first_text' => string 'first' (length=5)
'last_text' => string 'last' (length=4)
'projecttasks' =>
array
'item_limit' => int 5
'item_total' => int 8
'current_item' => int 1
'urlvar' => string 'next' (length=4)
'url' => string '/intranet/intra_plugins/collab/manageproject.php' (length=48)
'prev_text' => string 'prev' (length=4)
'next_text' => string 'next' (length=4)
'first_text' => string 'first' (length=5)
'last_text' => string 'last' (length=4)
|
AFTER pressing the next page in the table trhat has 'projecttasks' ID
Code: |
array
'default' =>
array
'item_limit' => int 10
'item_total' => null
'current_item' => int 1
'urlvar' => string 'next' (length=4)
'url' => string '/intranet/intra_plugins/collab/manageproject.php' (length=48)
'prev_text' => string 'prev' (length=4)
'next_text' => string 'next' (length=4)
'first_text' => string 'first' (length=5)
'last_text' => string 'last' (length=4)
'projlog' =>
array
'item_limit' => int 10
'item_total' => int 127
'current_item' => string '6' (length=1)
'urlvar' => string 'next' (length=4)
'url' => string '/intranet/intra_plugins/collab/manageproject.php' (length=48)
'prev_text' => string 'prev' (length=4)
'next_text' => string 'next' (length=4)
'first_text' => string 'first' (length=5)
'last_text' => string 'last' (length=4)
'projecttasks' =>
array
'item_limit' => int 5
'item_total' => int 8
'current_item' => string '6' (length=1)
'urlvar' => string 'next' (length=4)
'url' => string '/intranet/intra_plugins/collab/manageproject.php' (length=48)
'prev_text' => string 'prev' (length=4)
'next_text' => string 'next' (length=4)
'first_text' => string 'first' (length=5)
'last_text' => string 'last' (length=4)
|
As you can see it changed
'projlog' =>
'current_item' => string '6' (length=1)
when I want it to remain unchanged ('current_item' => int 1)
Thanks,
Jcorreia |
|
Back to top |
|
Celeb Administrator
Joined: 17 Apr 2007 Posts: 1025 Location: Vienna
|
Posted: Mon Jul 14, 2008 2:35 pm Post subject: |
|
|
Try setting different urlvars for the two paginations.
Code: | SmartyPaginate::setUrlVar('nexttask', 'projecttasks');
SmartyPaginate::setUrlVar('nextlog', 'projectlog'); |
_________________ Darn computers always do what I tell them to instead of what I want them to do. |
|
Back to top |
|
dolphin713 Smarty Rookie
Joined: 14 Jul 2008 Posts: 5
|
Posted: Tue Jul 15, 2008 10:16 am Post subject: |
|
|
Thanks, I will try that. |
|
Back to top |
|
dolphin713 Smarty Rookie
Joined: 14 Jul 2008 Posts: 5
|
Posted: Wed Jul 16, 2008 9:38 am Post subject: |
|
|
Hi,
that did half the trick, because they don+t conflitct anymore but the current item is not updated, and stays everytime in '1', So
Code: | $start = SmartyPaginate::getCurrentIndex('projecttasks'); | , is always returning '1'.
Here´s some debug information after I press the page 2 of tasks, which will build the url "...manageproject.php?action=showproject&id=11&nexttask=6"
Code: |
array
'default' =>
array
'item_limit' => int 10
'item_total' => null
'current_item' => int 1
'urlvar' => string 'next' (length=4)
'url' => string '/intranet/intra_plugins/collab/manageproject.php' (length=48)
'prev_text' => string 'prev' (length=4)
'next_text' => string 'next' (length=4)
'first_text' => string 'first' (length=5)
'last_text' => string 'last' (length=4)
'projlog' =>
array
'item_limit' => int 10
'item_total' => int 128
'current_item' => int 1
'urlvar' => string 'nextlog' (length=7)
'url' => string '/intranet/intra_plugins/collab/manageproject.php' (length=48)
'prev_text' => string 'prev' (length=4)
'next_text' => string 'next' (length=4)
'first_text' => string 'first' (length=5)
'last_text' => string 'last' (length=4)
'projecttasks' =>
array
'item_limit' => int 5
'item_total' => int 8
'current_item' => int 1
'urlvar' => string 'nexttask' (length=8)
'url' => string '/intranet/intra_plugins/collab/manageproject.php' (length=48)
'prev_text' => string 'prev' (length=4)
'next_text' => string 'next' (length=4)
'first_text' => string 'first' (length=5)
'last_text' => string 'last' (length=4)
|
Another thing I don+t understand is why there is a 'default' array, when I´m always using some ident.
What I´m I missing ?
Thanks,
jcorreia |
|
Back to top |
|
dolphin713 Smarty Rookie
Joined: 14 Jul 2008 Posts: 5
|
Posted: Wed Jul 16, 2008 9:44 am Post subject: |
|
|
Hi, found out why,
I was doing Code: | SmartyPaginate::disconnect(); |
everytime in a a previous page
This problem is solved...thanks
another thing, how can I change in the paginantion links, the current page we are in to bold ? |
|
Back to top |
|
dolphin713 Smarty Rookie
Joined: 14 Jul 2008 Posts: 5
|
Posted: Wed Jul 16, 2008 9:55 am Post subject: |
|
|
ok, found out I have to change smarty function smarty_function_paginate_middle()
Thanks! |
|
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
|