1

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 &raquo;</a></div>     
    {/if}

 </div>

 {if no_results}{redirect="404"}{/if}{/exp:channel:entries}
 {embed="parts/.footer"}
2
  • I couldn't find any way to change the prefix of LOW Events. So, what is "private_event_date"?
    – Sobral
    Aug 15 '13 at 0:55
  • Variables I neglected to change to 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.
    – Matt Stein
    Aug 15 '13 at 1:14
4

To be on the safe side, I'd check for numerical values only, like 201308. Something like this:

{if {event_dates:start_date format="%Y%m"} == {event_dates:end_date format="%Y%m"}}
  same month
{if:else}
  not same month
{/if}

When debugging the advanced conditionals, try to remove them and add them one at a time to see which actual one is causing the trouble.

1
  • Makes sense and worked like a charm – thanks!
    – Matt Stein
    Aug 15 '13 at 15:30
0

I guess you should to use exp:low_events:entries instead of exp:channel:entries.

2
  • Sadly, I get the same result with {exp:channel:entries} and {exp:low_events:entries}.
    – Matt Stein
    Aug 14 '13 at 21:28
  • 2
    Not necessary, really. The low_events:entries tag is meant for event listings. If you're displaying only one event (permalink style), then both tags act identically.
    – Low
    Aug 15 '13 at 6:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.