more efficient way?
I'm wondering if there is a more efficient wat to do this (it looks so bloated)? + Something strange...
I would like to have a page like to following:
- Current Events Header
-- Current Event 1
-- Current Event 2
- Upcoming Events Header
-- Upcoming Event 1
-- Upcoming Event 2
- Past Events Header
-- Past Event 1
-- Past Event 2
I want to Only show the headers if there are in fact events belonging to that particular section.
At the moment I'm doing this:
{exp:channel:entries channel="events" limit="1"}
{if event-date-low:active}
Current Events Header
{/if}
{/exp:channel:entries}
{exp:channel:entries channel="events" show_future_entries="yes" orderby="event-date-low" sort="desc"}
{if event-date-low:active}
Current Events HTML loop
{/if}
{/exp:channel:entries}
{exp:channel:entries channel="events" limit="1"}
{if event-date-low:upcoming}
Upcoming Events Header
{/if}
{/exp:channel:entries}
{exp:channel:entries channel="events" show_future_entries="yes" orderby="event-date-low" sort="desc"}
{if event-date-low:upcoming}
Upcoming Events HTML loop
{/if}
{/exp:channel:entries}
{exp:channel:entries channel="events" limit="1"}
{if event-date-low:passed}
Past Events Header
{/if}
{/exp:channel:entries}
{exp:channel:entries channel="events" show_future_entries="yes" orderby="event-date-low" sort="desc"}
{if event-date-low:passed}
Past Events HTML loop
{/if}
{/exp:channel:entries}
The strange thing is that the Past events header is not showing, while all past events are showing.
Replies
Low 18 Sep 2012 19:14
You could use this for passed events:
As for the other two lists -- having a little PHP on Output in your template would probably be most efficient. Something like this (untested): http://pastie.org/4748983
You could also take look at Stash to achieve those lists.