Skip to main content

Timeline for Preventing a double entries loop

Current License: CC BY-SA 3.0

8 events
when toggle format what by license comment
Jan 23, 2013 at 15:16 comment added Alex Kendrick Indeed. Switchee provides some great benefits and if the channel:entries innards were not identical that would be the way to go. But the original aim here was to avoid identical, duplicate loops from a DRY standpoint.
Jan 23, 2013 at 11:28 comment added Jérôme Coupé You could also keep both loops and use switchee or iflese by Mark Croxton to test your segment values. Only the tags inside the matching condition will remain in the template to be parsed. No overhead.
Jan 23, 2013 at 3:08 history edited Alex Kendrick CC BY-SA 3.0
cleaning up
Jan 22, 2013 at 22:30 vote accept noregt
Jan 22, 2013 at 22:30 comment added noregt Got it working, but had to restrict it to conditionals without if:else, instead used double if statements. Thanks!
Jan 22, 2013 at 21:03 comment added Alex Kendrick What you describe in your comment is wrapping just the opening tag in in advanced conditional which isn't going to work (as you said). But my example uses a simple conditional around just a parameter in the opening exp:channel:entries tag and should work fine. I have done similar many times in templates where I want a single channel entries loop to serve multiple purposes.
Jan 22, 2013 at 20:23 comment added noregt Are you sure that's doable with parse order? The reason why I started using this bulky method is because I was unable to put the entries tag in a conditional. Like: {if segment_1==""}{exp:channel:entries}{if:else}{exp:channel:entries category="1"}{/if}stuff{/exp:channel:entries} But I have to say that was still with EE1. Thanks for the lead to snippet sync!
Jan 22, 2013 at 18:06 history answered Alex Kendrick CC BY-SA 3.0