Skip to content

Instantly share code, notes, and snippets.

@ryanj
Created November 9, 2011 02:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ryanj/1350151 to your computer and use it in GitHub Desktop.
Save ryanj/1350151 to your computer and use it in GitHub Desktop.
mezzanine - example event list rendering function
$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