Displaying event dates in channel entries loop
I have a channel with a Low Events field called "event".
I am using the following code snippet from a jquery function, trying to pull data from channel entries. Other fields are coming in fine (e.g. {title}, {event_host}{url_title}{/event_host}), but not the start and end dates from the event field. I don't know if I'm even the right syntax to access the date fields correctly.
{exp:channel:entries channel="events" backspace="2"}
{
title: '{title}',
url: '{site_url}host/{event_host}{url_title}{/event_host}',
{if {event}{event_dates:all_day}{/event}}
start: new Date({event}{event_dates:start_date format="%Y,%n-1,%j,%G,%i "}{/event}),
end: new Date({event}{event_dates:end_date format="%Y,%n-1,%j,%G,%i "}{/event}),
allDay: true
{if:else}
start: new Date({event}{event_dates:start_date format="%Y,%n-1,%j,%G,%i "}{/event}),
end: new Date({event}{event_dates:end_date format="%Y,%n-1,%j,%G,%i "}{/event}),
allDay: false
{/if}
},
{/exp:channel:entries}
Replies
Low 9 Oct 2012 08:42
If your Low Events field is called "event", then use this syntax:
grege 9 Oct 2012 09:19
Thanks! Mostly working now - field dates showing nicely. Only problem is EE doesn't seem to be parsing the conditional tags:
{if event:all_day}
// do some JS stuff
{if:else}
// do some other JS stuff
{/if}
But suspect this is an EE thing rather than Low Event field.
Low 9 Oct 2012 09:26
Could well be. Try one of these options as the conditional opening statement: