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.

Check what pagination number is in entries tag, not within {pagination}

May 23, 2012 9:44pm

Subscribe [2]
  • #1 / May 23, 2012 9:44pm

    MrTomTom

    30 posts

    Hi there,

    Hopefully this is pretty simple:

    I’ve got a site with pagination of entries working well. the only thing I would like to do is make the first entry on the first page to have a different layout as it’s the first item.

    I use a simple count condition to set the layout for the page, but I don’t know how to check which page number you are on as {current_page} does not seem to work outside the paginate tag.

    If anyone has a suggestion that would be great thanks,

    Tom

  • #2 / May 23, 2012 10:03pm

    vosSavant

    380 posts

    If you’re familiar with jQuery you can use the first-child selector. If not, CSS also has a :first-child selector. Say your HTML looks like this:

    <section id="channel_entries">
       <article class="entry">...</article>
       <article class="entry">...</article>
    </section>

    You could then target the first entry with some CSS like:

    #channel_entries article:first-child { background:#ccc }
  • #3 / May 24, 2012 4:13pm

    Shane Eckert

    7174 posts

    Hey MrTomTom,

    Thank you for posting your question here on the ExpressionEngine forums.

    What do you think of vosSavant’s suggestion. Sounds pretty awesome to me.

    Please let us know!

    Cheers,

  • #4 / May 25, 2012 5:11am

    MrTomTom

    30 posts

    Hey there,

    Hmmm, lmy last post didn’t seem to have gone up. Guessing user problem (me!)

    A jquery solution would be great, but in this situation i needed to change the entire layout so it would not work. The way I achieved what I was trying to do was to compare the {last_segment} to the pages url and if they didn’t match it’s page 2 or more.

    It would be great if you were able to access a paging_number variable to get the P3 etc inside the entries tag tho.


    Cheers,

    Tom

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

ExpressionEngine News!

#eecms, #events, #releases