All Low add-ons are now owned by EEHarbor. Read the blog post.

Support archive

Displaying event dates in channel entries loop

grege 9 Oct 2012 08:40 problem, active

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

  1. Low 9 Oct 2012 08:42

    If your Low Events field is called "event", then use this syntax:

    {event:start_date} 
    {event:end_date}
    So basically:
    {low_events_field_name:xxxx}

  2. 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.

  3. Low 9 Oct 2012 09:26

    Could well be. Try one of these options as the conditional opening statement:

    {if event:all_day == "y"}

    {if "{event:all_day}" == "y"}

    {if '{event:all_day}' == 'y'}