Debug mode is on.

";} $calendar_xml_address = "http://www.google.com/calendar/feeds/".$gmail."/public/basic?start-min=".date("Y-m-d"); if ($debug_mode) {echo "

Getting XML feed

";} $feed = new SimplePie(); $feed->feed_url($calendar_xml_address); $feed->cache_location($cache_location); $feed->init(); foreach($feed->get_items() as $item) { if ($debug_mode) { echo "

Item found

"; } // Extract the 'when' information from the item summary, and ignore everything else $from = $item->get_description(); $from = trim(substr($from,strpos($from,"When: ")+6)); $findto = 'to'; $pos = strpos($from, $findto); if ($debug_mode) { echo "

Basing time on ".substr($from,0,$pos)."

"; } $time = strtotime(trim(substr($from,0,$pos))); // Extract the 'where' information from the item summary, and ignore everything else $where = $item->get_description(); $ignore_where=false; if (strpos($where,"Where: ")<1) {$ignore_where=true;} $where = substr($where,strpos($where,"Where: ")+6); $where = trim(substr($where,0,strpos($where,"<"))); if (substr($where,0,2)=="20" or $ignore_where) {$where = "";} // If there's no location, just ignore it // Extract the link for Google Calendar $url=$item->get_links(); // Stick into a nice array $bookings[]=array('time'=>$time,'where'=>$where,'title'=>$item->get_title(),'url'=>$url[0]); } // Sort the bookings into time order sort($bookings); // Date and Time format you want your details to appear $dateformat="l, F jS"; // Thursday, March 10th - see http://www.php.net/date for details $timeformat="g:i a"; foreach($bookings as $booking) { if ($booking['time']>0) {// If the time is valid echo "

".$booking['title'].""; echo "
".date($dateformat,$booking['time']); echo "
".date($timeformat,$booking['time']); if ($booking['where']) {echo "
".$booking['where'];} $count = $count + 1; if ($count == $maxlist) { break; } } } ?>