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

[SOLVED] Max of links in SmartyPaginate ?
Goto page Previous  1, 2
 
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
gman
Smarty Rookie


Joined: 27 Feb 2005
Posts: 5

PostPosted: Mon Feb 28, 2005 6:56 pm    Post subject: Reply with quote

Thanks for fixing the page [0] problem. I am still having problems. Using the latest CVS code. The second click after I click on a page higher than the midpoint of page_limit... then paginate seems to get "lost".

For instance, my page_limit is 10, my setLimit is 25, I get

[1][2][3][4][5][6][7][8][9][10]

if I click on 1-6, no problem. If I click on anything higher than 6, then things get screwey on the next click. My code is extremely simple. Here it is:

Template (test.tpl):
Code:
  <br><br>
 {* display pagination header *}
   Showing {$paginate.limit} per page.<br>
   Showing page {$paginate.last/$paginate.limit|ceil} of {$paginate.total/$paginate.limit|ceil}.<br>
    Items {$paginate.first}-{$paginate.last} out of {$paginate.total} displayed.<br>
   <br>
    {* display pagination info *}
    {paginate_first} {paginate_prev} {paginate_middle format="page" page_limit="10"} {paginate_next} {paginate_last}
   <br>
   <br>
    {* display results *}   
    {section name=i loop=$results}
        {$results[i]}<br>
    {/section}


PHP (test.php):
Code:
<?php
session_start();
require('/usr/local/lib/php/Smarty/Smarty.class.php');
require('/usr/local/lib/php/Smarty/SmartyPaginate.class.php');
$smarty = new Smarty();
SmartyPaginate::connect();
SmartyPaginate::setLimit(25);
$smarty->template_dir = '/wwwroot/smarty/templates';
$smarty->compile_dir = '/wwwroot/smarty/templates_c';
$smarty->cache_dir = '/wwwroot/smarty/cache';
$smarty->config_dir = '/wwwroot/smarty/configs';


    $start = SmartyPaginate::getCurrentIndex();
   $limit = SmartyPaginate::getLimit();
    $data = range(1,10000);
   
   $smarty->assign('results', array_slice($data, $start, $limit));
    SmartyPaginate::setTotal(count($data));
   SmartyPaginate::assign($smarty);
    $smarty->display('test.tpl');

 
?>
Back to top
View user's profile Send private message
mohrt
Administrator


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

PostPosted: Mon Feb 28, 2005 7:43 pm    Post subject: Reply with quote

oops, my fault. Try CVS again. Thanks for testing Wink
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: Mon Feb 28, 2005 8:00 pm    Post subject: Reply with quote

I also added the following to CVS:

{$paginate.page_current} {* the current page *}
{$paginate.page_total} {* the total number of pages *}
Back to top
View user's profile Send private message Visit poster's website
gman
Smarty Rookie


Joined: 27 Feb 2005
Posts: 5

PostPosted: Tue Mar 01, 2005 1:09 am    Post subject: Reply with quote

Beautiful! I just tried the latest version from CVS and it now works as expected.

Thanks!

Very Happy
Back to top
View user's profile Send private message
darren.hoo
Smarty n00b


Joined: 01 Mar 2005
Posts: 2
Location: Beijing,China

PostPosted: Tue Mar 01, 2005 11:46 am    Post subject: Reply with quote

great! morht.I have been looking for this for a long time!!!
Back to top
View user's profile Send private message MSN Messenger
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
Goto page Previous  1, 2
Page 2 of 2

 
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