-
-
Save litzinger/3124799 to your computer and use it in GitHub Desktop.
PHP in Events
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$_GET['cal_id'] = (isset($_GET['cal_id'])) ? $_GET['cal_id'] : array(); | |
$_GET['event_id'] = (isset($_GET['event_id'])) ? $_GET['event_id'] : array(); | |
?> | |
<?php if( empty($_GET['cal_id']) ) : ?> | |
{!-- the links from the old site didn't use cal_id or event_id. this will preserve their functionality --} | |
{if segment_3} | |
{exp:calendar:calendars calendar_name="{segment_3}" } | |
{redirect="events/detail/{calendar_url_title}?cal_id={calendar_id}"} | |
{/exp:calendar:calendars} | |
{/if} | |
<?php elseif( empty($_GET['event_id']) ) : ?> | |
{!-- preserve the old links and enable the "recommended classes" to work without the event_id --} | |
{exp:calendar:events calendar_id="<?php echo $_GET['cal_id'] ?>" date_range_start="today" date_range_end="1 year"} | |
{occurrences limit="1"} | |
{redirect="events/detail/{calendar_url_title}?cal_id={calendar_id}&event_id={event_id}"} | |
{/occurrences} | |
{/exp:calendar:events} | |
<?php endif; ?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment