Created
November 9, 2011 02:35
-
-
Save ryanj/1350151 to your computer and use it in GitHub Desktop.
mezzanine - example event list rendering function
This file contains 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
$custom_render_function = function($evnt){ | |
$time = strtotime($evnt->start_date); | |
if( isset($evnt->venue) && isset( $evnt->venue->name )){ | |
$venue_name = $evnt->venue->name; | |
}else{ | |
$venue_name = 'online'; | |
} | |
if( isset($evnt->organizer) && isset( $evnt->organizer->name )){ | |
$organizer_name = $evnt->organizer->name; | |
$orgznizer_url = $evnt->organizer->url; | |
}else{ | |
//Default values for Events with invalid "organizer" settings: | |
$organizer_name = "The Mezzanine"; | |
$orgznizer_url = 'http://www.mezzaninesf.com/'; | |
} | |
$event_html = "<div class='eb_event_list_item' id='evnt_div_" | |
. $evnt->id ."'><span class='eb_event_list_date'>" | |
. strftime('%a, %B %e', $time) . "</span><span class='eb_event_list_time'>" | |
. strftime('%l:%M %P', $time) . "</span><a class='eb_event_list_title' href='" | |
. $evnt->url."'>".$evnt->title."</a><span class='eb_event_list_location'>" | |
. $venue_name . "</span><a class='eb_event_list_organizer' src=' . $organizer_url . '>" | |
. $organizer_name . "</a></div>\n"; | |
return $event_html; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment