Jump to:

3434 Posts in 1026 Topics by 866 members

Template Questions

SilverStripe Forums » Template Questions » navigation in pagination

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

Page: 1
Go to End
Author Topic: 2206 Views
  • snaip
    Avatar
    Community Member
    180 Posts

    navigation in pagination Link to this post

    hi

    i have 20 pages with pagination
    the default function in documentation http://doc.silverstripe.org/private:recipes:pagination get all page number in the list

    << prev 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20 next >>

    how to modify it to get

    1,2,3,4, |5| .... 20 next >>

    like in forum ?

    what about 100 pages ? ; )

  • ram
    Avatar
    Community Member
    19 Posts

    Re: navigation in pagination Link to this post

    Hi

    Please find the url

    http://doc.silverstripe.org/searchcontext

    also find below help for slide pagination.

    <% if Results.NotFirstPage %>
             <a class="prev" href="$Results.PrevLink" title="View the previous page"> &laquo; Previous</a>
           <% end_if %>
          
             <% control Results.Pages(5) %>
              <% if CurrentBool %>
                <a href="#" class="current">$PageNum</a>
              <% else %>
                <a href="$Link" title="View page number $PageNum">$PageNum</a>
              <% end_if %>
             <% end_control %>
          
           <% if Results.NotLastPage %>
             <a class="next" href="$Results.NextLink" title="View the next page"> Next &raquo;</a>
           <% end_if %>

    Hope its helps

    Regards,
    Ram
    http://www.agriya.com

  • martimiz
    Avatar
    Forum Moderator
    1067 Posts

    Re: navigation in pagination Link to this post

    Instead of

    <% control Results.Pages(5) %>


    you could also use

    <% control Results.PaginationSummary(5) %>


    This would add the first and the last page to the list.

    [EDIT]
    Found the way to add the dots as well - all documented within the DataObjectSet class:

    <% control ProductList.PaginationSummary(5) %>
       <% if CurrentBool %>
          <strong>$PageNum</strong>
       <% else %>
          <% if Link %>
             <a href="$Link" title="<% _t('GOTOPAGE', 'Go to') %> $PageNum">
                $PageNum
             </a>
          <% else %>
             ...
          <% end_if %>
       <% end_if %>
    <% end_control %>

  • ccburns
    Avatar
    Community Member
    74 Posts

    Re: navigation in pagination Link to this post

    Awesome thanks @martimiz for the information. Works perfect.

    Cheers,
    Colin

    2206 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.