0

I have a page that shows the Day's events. It currently uses:

{event_first_date}

This is great except with repeating events - which continues to show the first date of the event. I reviewed the documentation but did not see an option to display

{event_current_date}

or something like that. Any clues as to what that would be?

Thanks.

1 Answer 1

1

A complete answer to your question requires a bit more context than you have provided, but this is a common question, so I will make some assumptions. :)

If this is a page using Calendar:Events tag to display complete/more info about an event, and you are linking to this page from a page such as a full month view calendar, we'll often use this workaround:

In the full month view template (using Calendar:Cal), we'll adjust the link for the title of the event to have this extra code:

{if event_recurs}{event_start_date format="%Y/%m/%d"}/{/if}

So, the complete code for the title link would be:

<a href="{path='calendar/events'}/{event_url_title}/{if event_recurs}{event_start_date format="%Y/%m/%d"}/{/if}">{event_title}</a>

What that will do is add some fake date values into the URI, which can be retrieved later ;)

Then, in your Event detail page (using Calendar:Events tag), you would have something like this code:

{exp:calendar:events
   event_name="{segment_3}" <!-- grabs URL title from 3rd segment, where we sent it -->
   event_limit="1"
   dynamic="no"
}
   <h2>{event_title}</h3>
   <p>
      {if event_recurs}
         {exp:calendar:date
            base_date="{segment_4}-{segment_5}-{segment_6}"
            output_date="today"
         }
            {date format="%l, %F %j"} @ {event_start_date format="%g:%i%a"}
         {/exp:calendar:date}
      {if:else}
         {event_start_date format="%l, %F %j @ %g:%i%a"}
      {/if}
   </p>
{/exp:calendar:events}

You'll see that we're using the date values from the URI that we passed on from the previous template, and now feeding them into the Calendar:Date tag, and telling it to parse those segments into a formatted date. We then use the {event_start_date ... } variable, but only for the time parsing.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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