I've just started using Low Events after realizing the hard way why I need it. I'm attempting to format a nice string when the range happens within the same month; instead of August 14, 2013 - August 16, 2013
, I'd like to display August 14-16, 2013
.
I've attempted to compare formatted output of the month and year only, like this...
{if '{event_dates:start_date format="%F%Y"}' == '{event_dates:end_date format="%F%Y"}'}
{event_dates:start_date format="%F %j"}-{event_dates:end_date format="%j, %Y"}
{if:else}
{event_dates:start_date format="%F %j, %Y"} - {event_dates:end_date format="%F %j, %Y"}
{/if}
...yet instead of the expected output EE just complains that it choked on the conditional:
Parse error: syntax error, unexpected T_STRING in /var/www/vhosts/foo.com/httpdocs/system/expressionengine/libraries/Functions.php(683) : eval()'d code on line 56
Using parse="inward"
had no effect, and I've isolated that first {if
conditional as the problem. Is there any way to achieve the formatting I'd like without relying on an embedded template?
I also tried swapping the single and double quotes as Robson suggested, but that had no effect.
This is EE 2.5.5 and Low Events 1.1.4, and swapping {exp:channel:entries}
for {exp:low_events:entries}
makes no difference.
Here's the entire (simplified) template for context:
{exp:channel:entries channel="events" limit="1" url_title="{segment_2}"}
{embed="parts/.header" page_title="{title}"}
<div id="content">
<h3>{if '{event_dates:all_day}' == 'y'}
{if '{event_dates:one_day}' == 'y'}
{event_dates:start_date format="%F %j, %Y"}
{if:else}
{if '{event_date:start_date format="%F%Y"}' == '{event_date:end_date format="%F%Y"}'}
{event_dates:start_date format="%F %j"}-{event_dates:end_date format="%j, %Y"}
{if:else}
{event_dates:start_date format="%F %j, %Y"} - {event_dates:end_date format="%F %j, %Y"}
{/if}
{/if}
{if:elseif '{event_dates:one_day}' == 'y'}
{event_dates:start_date format="%F %j, %Y"} - {event_dates:start_time format="%g:%i%a"}-{event_dates:end_time format="%g:%i%a"}
{if:else}
{event_dates:start_date format="%F %d, %Y"} - {event_dates:start_time format="%g:%i%a"} to {event_dates:end_date format="%F %d, %Y"} - {event_dates:end_time format="%g:%i%a"}
{/if}
{if event_location}
<br/>{event_location}
{/if}
</h3>
<hr/>
{event_description}
{if event_rsvp_link}
<div class="rsvp"><a href="{exp:extract_url}{event_rsvp_link}{/exp:extract_url}">RSVP Now »</a></div>
{/if}
</div>
{if no_results}{redirect="404"}{/if}{/exp:channel:entries}
{embed="parts/.footer"}
event_dates
when I simplified my template, sorry. I ended up hacking ft.low_events.php to add{event_dates:same_month}
which works just like :all_day and :one_day – this is getting me by for now.