Conditional with all_day
Hi Low,
I have two channels using the same channel-fields, called "items" and "events".
In case of an event i want to show the event-date. So far so good, but i'd like to show only the start-date for events that only lasts one day (all_day).
So i wrote this conditional:
{if channel_short_name == "events"}
{if datum:all_day } Hele dag {datum:start_date format="%j %F"} {/if}
{datum:start_date format="%j %F"} - {datum:end_date format="%j %F"}
{/if}
If I use this the phrase 'Hele dag" will appear and so will the date 3 times!
When I use
{if channel_short_name == "events"}
{if datum:all_day } Hele dag {datum:start_date format="%j %F"} {if:else}
{datum:start_date format="%j %F"} - {datum:end_date format="%j %F"}
{/if}
The output is 0 entries???
I tried this also
{if channel_short_name == "events" AND datum:all_day}
Hele dag {datum:start_date format="%j %F"} {if:else}
{datum:start_date format="%j %F"} - {datum:end_date format="%j %F"}
{/if}
But the all entries (items and events) will get a date or when no date assigned a "-"
What's the best way to write this conditional?
Replies
Low 3 Jun 2014 16:15
Your second example misses a closing {/if} statement. This code should work:
Possibly wrapped inside your channel_short_name conditional.