[3.6] pagination for section page with page numbers?
  • How to make nice pagination with all pages listed like here: http://booki.flossmanuals.net/newscoop-3-cookbook-3-5-2/_dra ft/_v/1.0/pagination/
    but on section page?
  • 6 Comments sorted by
  • Lately I use this code, and it works in 4.0

    {{ $pages=ceil($gimme->current_list->count/5) }}
    {{ $curpage=intval($gimme->url->get_parameter($gimme->current_list_id())) }}
    {{ if $pages gt 1 }}
    <ul class="pagination">
        {{ if $gimme->current_list->has_previous_elements }}<li class="prev"><a href="{{ uripath options="section" }}?{{ urlparameters options="previous_items" }}">Previous</a></li>{{ /if }}
        {{ for $i=0 to $pages - 1 }}
            {{ $curlistid=$i*5 }}
            {{ $gimme->url->set_parameter($gimme->current_list_id(),$curlistid) }}
            {{ if $curlistid != $curpage }}
        <li><a href="{{ uripath options="section" }}?{{ urlparameters }}">{{ $i+1 }}</a></li>
            {{ else }}
        <li class="selected"><a href="{{ uripath options="section" }}?{{ urlparameters }}">{{ $i+1 }}</a></li>
            {{ $remi=$i+1 }}
            {{ /if }}
        {{ /for }}
        {{ if $gimme->current_list->has_next_elements }}<li class="next"><a href="{{ uripath options="section" }}?{{ urlparameters options="next_items" }}">Next</a></li>{{ /if }}
    </ul>
    {{ $gimme->url->set_parameter($gimme->current_list_id(),$curpage) }}
    {{ /if }}
    --
    Ljuba Rankovic
    Senior Front End Developer, Sourcefabric
    ljuba.rankovic@sourcefabric.org

    http://www.sourcefabric.org
    http://www.twitter.com/Sourcefabric
  • Exactly the same way, just when creating article list, make both lists without ignore_issue="true" parameter (if you want to limit to articles from active section and issue, that is)

    {{ list_articles columns="10" }}
    --
    Ljuba Rankovic
    Senior Front End Developer, Sourcefabric
    ljuba.rankovic@sourcefabric.org

    http://www.sourcefabric.org
    http://www.twitter.com/Sourcefabric
  • Vote Up0Vote Down Sava TatićSava Tatić
    Posts: 113Member, Administrator, Sourcefabric Team
    Can we include this example in the cookbook?

    On Mon, Oct 3, 2011 at 4:40 PM, ljuba rankovic <
    newscoop-support@lists.sourcefabric.org[/email]> wrote:

    > **
    > Exactly the same way, just when creating article list, make both lists
    > without ignore_issue="true" parameter (if you want to limit to articles from
    > active section and issue, that is)
    >
    > {{ list_articles columns="10" }}
    >


  • This is the code that works for me. There is one strange thing: I can't get ls-art1 variable by smarty.get.ls-art1. That's why I used PHP.

     {{ if $gimme->current_list->at_end && $gimme->current_list->count > $gimme->current_list->length }}
    {{php}}
    $this->assign("page",$_GET['ls-art1']);
    {{/php}}
    
    <div id="pagination">
       {{ if $gimme->current_list->has_previous_elements }}
         <a href="{{ uri options="previous_items" }}">Previous</a>
       {{ else }}
         Previous
       {{ /if }}
        <ul class="numbers">
        	      {{ list_articles columns="10" ignore_issue="true" ignore_section="false" }}
    {{ if $gimme->current_list->count > 10 }}
       
        {{ if $gimme->current_list->column == 1 }}
            {{ if $gimme->current_list->row*10-10 == $page }}
               <li>{{ $gimme->current_list->row }}</li>
            {{ else }}
               <li><a href="{{ uri options="section" }}?ls-art1={{ $gimme->current_list->row*10-10 }}">{{ $gimme->current_list->row }}</a></li>
          
    		{{ /if }}
        {{ /if }}
        
    {{ /if }}
    {{ /list_articles }}
    
    		
        </ul>
       {{ if $gimme->current_list->has_next_elements }}
      
         <a href="{{ uri options="next_items" }}">Next</a>
       {{ else }}
         Next
       {{ /if }}
       </div>
    {{ /if }}
  • I find, THANK YOU
  • but it seems that it does not work in 4.0. If You make it work in 4.0 please give me a sign.