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.

Print the last 7 entries

May 03, 2012 1:16pm

Subscribe [1]
  • #1 / May 03, 2012 1:16pm

    fedejp

    3 posts

    Hi, I’ve got a channel with 14 entries and I need to separate them into to columns of 7. My problem is how to do this. first I tried with PHP:

    <?php $count++; if($count==7) echo "</ul><ul>";?>

    I put this inside the {channel:entries} but the count doesn’t go up; it remains “1”.

    Then I made to separated entries limiting them to print 7 entries. But of course they printed the first 7 entries twice. I think the best way to do it is using EE. So, I need to know how can I print the second row starting with the first of the last 7 entries. I assume that you can do it by specifying the entry_id; but I prefer to do it without using the entry_id because this may change. If it’s not possible to do it using EE then PHP is just fine. Any solution will be very welcome.

    Thanks in advance

  • #2 / May 03, 2012 1:27pm

    Bhashkar Yadav

    727 posts

    Hi,

    you should try with offset parameter like :

    to print first 7 entries :

    {exp:channel:entries channel="channel_name" offset="1" limit="7"}

    to print next 7 entries :

    {exp:channel:entries channel="channel_name" offset="7" limit="7"}


    Hope this would help you.

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

    fedejp

    3 posts

    That’s it man!
    Thanks a lot for the quick answer!

    Cheers 😊

  • #4 / May 03, 2012 3:00pm

    fedejp

    3 posts

    Just something to point out: the first offset needs to be set to “0” not “1”. Just in case somebody make use of this.

    Cheers

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

ExpressionEngine News!

#eecms, #events, #releases