I have 6 news articles. I would like to structure the first 2 as featured and the remaining 4 as smaller sublinks. Is there any way to do this with a single call for the latest 6 entries, as opposed to calling 2 and then calling 4 with the offset?
This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.
The active forums are here.
November 21, 2011 3:09pm
Subscribe [3]#1 / Nov 21, 2011 3:09pm
I have 6 news articles. I would like to structure the first 2 as featured and the remaining 4 as smaller sublinks. Is there any way to do this with a single call for the latest 6 entries, as opposed to calling 2 and then calling 4 with the offset?
#2 / Nov 22, 2011 7:48am
Hi astuteo,
If it’s always just 6 entries broken up into 2 and 4 then yes you could do something like this :
{exp:channel:entries
channel="default_site"
limit="6"
disable="member_data|trackbacks|categories|category_fields|pagination"}
{if count == "1" OR count == "2"}
Markup for items 1 & 2…
{if:else}
Markup for other 4 items here…
{/if}
{/exp:channel:entries}Hope that helps a bit.
Best wishes,
Mark
#3 / Nov 22, 2011 9:29am
Cool, thanks! So follow-up question, is that any more efficient/faster etc than making two separate calls with exp:channel:entries tags?
#4 / Nov 22, 2011 9:31am
Hiya,
I would say it’s definitely more efficient yes as there will be less database calls to the system.
If you want to find out if it is indeed faster / more efficient though you could code up two different templates with the two separate methods in them and turn on Template Profiler to see how long / how many queries each method makes though.
Best wishes,
Mark
#5 / Nov 22, 2011 9:42am
Thanks, brother. Will do.
#6 / Nov 22, 2011 3:16pm
Glad Mark was able to help you out, astuteo! Let us know if there’s anything we can do to help.