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.

Pagination

May 01, 2012 8:10am

Subscribe [2]
  • #1 / May 01, 2012 8:10am

    ummo

    4 posts

    Hi,

    So I’m outputting a list of articles from a channel, but on page 1 I want to show 9 articles with a unique style on the first article. Then on all following pages I want to show only 8 articles.  Anyone know f this is possible?

    Cheers

    George

  • #2 / May 01, 2012 9:51am

    John St-Amand

    865 posts

    The only solution that leaps to mind, without getting into PHP is something like this:

    {if segment_1 == "blog"}
    <!-- this is just an example - just wrap a conditional around this one that would have it only display on the main list view page -->
    {exp:channel:entries channel="your_channel" limit="1" disable="member_data" orderby="date" sort="desc" dynamic="no"}
    <!-- your code here -->
    {/exp:channel:entries}
    {/if}
    
    {exp:channel:entries channel="your_channel" offset="1" limit="8" disable="member_data" orderby="date" sort="desc" dynamic="yes"}
    <!-- your code here -->
    
    <!-- your pagination code here -->
    {/exp:channel:entries}

    Not sure that’s the best way to handle it, but I couldn’t think of a way to have 9 on the first page and only 8 on the second page within the same entries loop.  But perhaps someone else will chime in with another option.

  • #3 / May 03, 2012 4:35am

    ummo

    4 posts

    Thanks John, I think that has done the trick, all though it was the conditional on that first loop that was throwing me. Ended up using the following…

    {if segment_2 == "" OR segment_2 == "P0" }
    <!—first loop with limit=“1” here—>
    {/if}

    The reason for this was that if you hit the previous button after going to page 2 it was adding P0 into the URL after blog/

    Cheers

    George

     

     

  • #4 / May 03, 2012 7:04am

    John St-Amand

    865 posts

    Ah, yes I hadn’t thought about the user backing up - you’re right. Glad to hear you have it sorted.

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

ExpressionEngine News!

#eecms, #events, #releases