ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

v.2.0 and Changing default number of links displayed

November 12, 2010 12:51am

Subscribe [2]
  • #1 / Nov 12, 2010 12:51am

    Jacobmiso

    51 posts

    I’ve seen this done but haven’t been able to invent a way to do it:

    By default, the basic paginate function displays between 3 and 5 live links along with the other info, Like this. It appears to depend on available width, ie - if it displays “last” etc.

    Page 1 of 48 pages 1 2 3 >  Last ยป


    I need to display about 10 (and also remove “next” last” etc text if possible

    It would essentially display as this:

    < 1 2 3 4 5 6 7 8 9 10 >


    I hope it’s easy to do, any help would be appreciated.

    btw, the code I’m using is the basic sample below taken directly from the user guide
    **Please note that this weblog sample is from 1x of course - however paginate in my 2.0 installs seems to work exactly the same -
    Im trying to setup for both

    {exp:weblog:entries weblog="latestnews" orderby="date" sort="desc" limit="1" paginate="bottom"}
    <h2>{title}</h2>
    <p>{summary}<br />
    {content}<br />
    {paginate}</p>
    
    <p>Page {current_page} of {total_pages} pages {pagination_links}<br />
    {/paginate}<br />
    {/exp:weblog:entries}

    Thanks


    [Mod Edit: Moved to the CodeShare Corner forum]

  • #2 / Nov 12, 2010 9:51am

    Ingmar

    29245 posts

    Please take a look at .../system/codeigniter/system/libraries/Pagination.php. You can specify there how many links you want EE to create.

  • #3 / Nov 13, 2010 5:12am

    Jacobmiso

    51 posts

    Thanks for the tip. Was able to customize how many links display and some interesting stuff.

    The var $num_links stopped me ultimately though, as it applies ‘symmetrically to before And after the current page. Since I want to display this:
    <12345678910> , if page 2 is selected, or 10 for example, the whole block moves.

  • #4 / Nov 14, 2010 1:31pm

    Greg Salt

    3988 posts

    Hi Jacobmiso,

    I’ll move this thread to the CodeShare Corner since it’s more appropriate there but you might check on Devot://ee to see if there is an addon that will do what you need.

    Cheers

    Greg

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases