• 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 Reply to topic  [ 3 posts ] 
Author Message
 Post subject: Pagination in news module
PostPosted: Sun Dec 20, 2009 11:48 am 
Offline
Forum Members
Forum Members

Joined: Thu Apr 23, 2009 3:34 pm
Posts: 66
Hello,

I need pagination which look like google or cmsmadesimple forum etc. for example: "Prievious 1, 2, 3, 4, 5... Next". Now my module is that: "Page 1 of 2  > >>" and my summary code example is:

{if $pagecount > 1}


{if $pagenumber > 1}
{$firstpage} {$prevpage} 
{/if}

{$pagetext} {$pagenumber} {$oftext} {$pagecount}
{if $pagenumber < $pagecount}
 {$nextpage} {$lastpage}
{/if}


{/if}


I have searched but with no results.

Can anyone help me with that? Please


Top
 Profile  
 
 Post subject: Re: Pagination in news module
PostPosted: Sun Dec 20, 2009 9:26 pm 
Offline
Administrator
Administrator
User avatar

Joined: Thu Mar 09, 2006 5:32 am
Posts: 10682
Location: Arizona
This is something that is hard coded into News...

if page number is greater than 1 you get firstpage link and previouspage link...

if not you just get pagetext "Page" then the page your on number, pagenumber, then oftext=of then count of pages, pagecount, then if pagenumber is less then pagecount you get nextpage, >, and lastpage, >>...

All of these are set in the lang. file for news...

_________________
Extensions » Modules/Tags click the name of the module/tag or Help to the right to get it's parameters.
Right click and view source is a great way to see what you have to work with.
Check ver. CMSMS, PHP, server OS, in System Information page.
Default content http://multiintech.com/defaultcontent/
People are Wonderful
Business is Great
Life is Terrific
Ever wonder what happened to the Album module? Well it is alive and well.
http://album.multiintech.com/

Image


Top
 Profile  
 
 Post subject: Re: Pagination in news module
PostPosted: Tue Dec 22, 2009 9:30 am 
Offline
Power Poster
Power Poster
User avatar

Joined: Thu May 14, 2009 8:11 pm
Posts: 1269
Location: Lithuania
I also thought it would be nice to have such pagination.
It works with ugly url.
For pretty url some regexp should be done (i guess page is the last number in url)
Code:
{if $pagecount > 1}
 <p>

{*------------------ max_extra_numbers -----------------------*}
{assign var='max_extra_numbers' value=3}
{*------------------/ max_extra_numbers -----------------------*}

{if $pagenumber > 1}
{$firstpage} {$prevpage} 

{*------------------ page numbers before-----------------------*}
{assign var='mod' value=`$gCms->modules.News.object`}

{assign var='extra_number_start' value=`$pagenumber-$max_extra_numbers`}
{if $extra_number_start<1}
  {assign var='extra_number_start' value=1}
{/if}

{section name='extra_pagination' start=`$extra_number_start`  loop=`$pagenumber` step=1}

{if $smarty.section.extra_pagination.index < $pagenumber}
    {capture assign='search_page'}pagenumber=1{/capture}
    {capture assign='replace_page'}pagenumber={$smarty.section.extra_pagination.index}{/capture}
     {capture assign='search_number'}>{$mod->Lang('firstpage')}<{/capture}
     {capture assign='replace_number'}>{$smarty.section.extra_pagination.index}<{/capture}

{$firstpage|replace:$search_page:$replace_page|replace:$search_number:$replace_number}
 {/if}
{/section}
{*------------------/ page numbers before-----------------------*}

{/if}
{$pagetext} {$pagenumber} {$oftext} {$pagecount}

{if $pagenumber < $pagecount}

{*------------------ page numbers after-----------------------*}
{assign var='extra_number_start' value=`$pagenumber+1`}

{assign var='extra_number_end' value=`$pagenumber+$max_extra_numbers+1`}
{if $extra_number_end>$pagecount}
  {assign var='extra_number_end' value=$pagecount}
{/if}

{section name='extra_pagination' start=`$extra_number_start`  loop=`$extra_number_end` step=1}

{if $smarty.section.extra_pagination.index < $extra_number_end}
    {capture assign='search_page'}pagenumber={$pagecount}{/capture}
    {capture assign='replace_page'}pagenumber={$smarty.section.extra_pagination.index}{/capture}
     {capture assign='search_number'}>{$mod->Lang('lastpage')}<{/capture}
     {capture assign='replace_number'}>{$smarty.section.extra_pagination.index}<{/capture}

{$lastpage|replace:$search_page:$replace_page|replace:$search_number:$replace_number}
 {/if}
{/section}
{*------------------/ page numbers after-----------------------*}


 {$nextpage} {$lastpage}
{/if}
</p>
{/if}
---


Edit: explicit "$mod" assignment.
Code:
{assign var='mod' value=`$gCms->modules.News.object`}

_________________
My best friends are: FAQ: How can I debug my code/site ?...showtemplate=false...module_customhow to create a patch, {process_pagedata}
And Yours ? :)


Last edited by Peciura on Tue Dec 22, 2009 6:01 pm, edited 1 time in total.

Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC


Who is online

Users browsing this forum: andrewvideo


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:  
Arvixe - A CMSMS Partner