2

I want to grab the 1 most recent entry and display it big. Then I want to grab the next most 6 recent entries and display them small.

So: {exp:channel:entries channel="blog" limit="1"} and {exp:channel:entries channel="blog" limit="6" offset="1"}

The problem is if my most recent blog entry is closed. Then nothing big shows up and the small items start at the 2 blog entry (the closed entry is offset). I get the same results if I add status="open".

All this time I had assumed exp:channel:entries would consider the status before applying the rest of the params, especially limit and offset. Since status param defaults to open, obviously I want to limit to the open entries.

Am I wrong? Is it something new with v2.8.1? How did you think it worked?

3
  • 2
    I haven't experimented much with the offset parameter, but to do what you want (first entry big, next 6 small) you could use the {if count == 1 }{/if} conditional.
    – positlux
    Aug 28, 2014 at 1:52
  • @positlux please post that as an answer Aug 28, 2014 at 3:29
  • I was going to post this as answer, but the OP actually asked about the behavior of the status/limit/offset parameters -- to which I do not actually know the answer to.
    – positlux
    Aug 28, 2014 at 15:24

1 Answer 1

4

Here's a basic setup for what you're trying to achieve, with the class .biggie representing the markup for making your entry big, and the absence of that class indicating a "normal" representation of your remaining entires.

NOTE: Since the default order for channel entry output is reverse date order (newest first) you do not need to specify any order or sort. If you wanted to sort/order by a different criteria, you would simply add that to the opening parameters.

{exp:channel:entries
  channel="blog"
  limit="7"
}

  {if no_results}{redirect="404"}{/if}

  {if count == "1"}
    <h2 class="biggie">{title}</h2>
    <p class="biggie">{body}</p>

  {if:else}
    <h2>{title}</h2>
    <p>{body}</p>
  {/if}

{/exp:channel:entries}
0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.