I currently have a pretty default setup of the Calendar module and a custom content type as events that show up on this calendar. I was looking for a way that a user could navigate through the calendar, click on the event, and then create a back link that would take them back to the calendar they were on.

My calendar url is setup to be sometihng like:

http://domain.com/calendar/2009/03/all (basically YYY/mm/all-days).

In my template I then used the field_start_date (setup as part of my custom content) to construct the return url with a little help from php:

<p><a href="/board/calendar/<?php echo date( "Y", strtotime( $node->field_start_date[0]['value'] ) )?>/<?php echo date( "m", strtotime( $node->field_start_date[0]['value'] ) )?>/all">Return</a></p>

Anyway hope that helps someone ... I'd love to hear if there are better ways to do this.

Mark

Comments

nevets’s picture

Minor point, date can deal with more than one part at a time so

<?php echo date( "Y", strtotime( $node->field_start_date[0]['value'] ) )?>/<?php echo date( "m", strtotime( $node->field_start_date[0]['value'] ) )?>

can be simplified to

<?php echo date( "Y/m", strtotime( $node->field_start_date[0]['value'] ) )?>
msteudel’s picture

Thanks, much cleaner!