• twitter image
  • facebook image
  • youtube image
  • linkedin image
Language: CMS Made Simple Czech CMS Made Simple France CMS Made Simple Spain CMS Made Simple Hungary CMS Made Simple Russia CMS Made Simple Netherlands

All times are UTC




Post new topic This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 
Author Message
 Post subject: LisIt2 pagination limit
PostPosted: Fri May 22, 2020 8:17 am 
Offline
Forum Members
Forum Members

Joined: Thu Dec 13, 2012 2:54 pm
Posts: 200
Hello everyone!
How could I limit the number of ListIt2 summary pagination? Right now a page contains 86 items and it's way too much. I would like to reduce it to something like:

< << 1 2 3 4 5 6 7 >> >

The pagination code is:

\$1:
      {if $pagecount > 1}
         <p>
            {if $pagenumber > 1}
               {$firstpage}&nbsp;{$prevpage}&nbsp;
            {/if}

            {foreach from=$pagelinks item=page}
               &nbsp;{$page->link}&nbsp;&nbsp;
            {/foreach}

            {if $pagenumber < $pagecount}
               &nbsp;{$nextpage}&nbsp;{$lastpage}
            {/if}
         </p>
      {/if}


I simply suck when it comes to tweaking code so I would appreciate any kind of help or hint! ;D
Thank you in advance and have a great weekend y'all!


Top
  Profile  
 
Share On:
Share on Facebook Share on Twitter Share on Google+
 Post subject: Re: LisIt2 pagination limit  Topic is solved
PostPosted: Fri May 22, 2020 11:27 am 
Offline
Dev Team Member
Dev Team Member

Joined: Mon Nov 28, 2011 9:29 am
Posts: 3210
Location: The Netherlands
Hope you're talking about LISE (ListIt2 is old).

The first, previous, next and last urls are not a problem I presume.

The numbers are a little more difficult but doable. Your example shows 7 numbers so I'll use it too.

Further I added some ellipsis to show before and/or after the page numbers. Of course that's optional.

\$1:
{if $pagecount > 1}
 <p>
   {if $pagenumber > 1}
      {$firstpage}&nbsp;{$prevpage}&nbsp;
   {/if}
         
{* number of pages to show = 7. So if possible current page, 3 before, 3 after *}
{$before=''}{* used for ellipsis *}
{$after=''}{* used for ellipsis *}
{if $pagecount <= 7}
  {$from = 1}{$to = $pagecount}
{else}
  {if $pagenumber <= 3}
    {$from = 1}{$to = 7}
    {if $pagecount > 7}{$after='&hellip;'}{/if}
  {elseif $pagecount - $pagenumber <= 3}
    {$from = $pagecount - 6}{$to = $pagecount}
    {if $pagecount > 7}{$before='&hellip;'}{/if}
  {else}
    {$from = $pagenumber - 3}{$to = $pagenumber + 3}   
    {if $pagecount > 7}{$before='&hellip;'}{$after='&hellip;'}{/if}
  {/if}
{/if}
{$before}
   {for $i = $from to $to}
     <a{if $i == $pagenumber} class="current"{else} href="{$pagelinks[$i]->url}"{/if}>{$i}</a>
   {/for}
{$after}

   {if $pagenumber < $pagecount}
      &nbsp;{$nextpage}&nbsp;{$lastpage}
   {/if}
 </p>
{/if}


Top
  Profile  
 
Share On:
Share on Facebook Share on Twitter Share on Google+
 Post subject: Re: LisIt2 pagination limit [SOLVED]
PostPosted: Fri May 22, 2020 11:42 am 
Offline
Forum Members
Forum Members

Joined: Thu Dec 13, 2012 2:54 pm
Posts: 200
Dear Velden!
Thank you for your post, it's working solution right out of the box! ;D
I have already tested it and it works like a charm.
I know ListIt2 is old but so is the site I was taking care of. Over the years it grew up very big but I was denied whenever I suggested to do upgrade and, if necessary, a make-over. Until now... They just contacted me a few days ago to discuss my proposal but also to ask if it's possible to make some minor tweaks (like favicon and BS like that). Among that was this case but hopefully, in the near future I'll finally move it all to the latest version of CMSMS. Fortunately, LISE can import old ListIt2 items and hopefully there won't be too much trouble to transfer it.
Thank you very much for helping me out with this, hope you are ok and keep safe and healthy!
Best regards from Croatia ;D


Top
  Profile  
 
Share On:
Share on Facebook Share on Twitter Share on Google+
Display posts from previous:  Sort by  
Post new topic This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users


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 post attachments in this forum

Search for:
Jump to:  
A2 Hosting