Ben bir web sitesine google takvimden tarihleri gömme ediyorum, ve bu sıralama hariç, tüm çalışma bulunuyor. Nedense, ben gerçekten normal kronolojik (ilk olay) olarak atar gibi ters kronolojik sırayla içine sıralar.
Bu çıkış:
August 11th: Intern depart
August 6th: Last Day of Summer Camp
July 7th: Ignore this
July 6th: This is another example event
July 5th: example
June 28th: Summer Camp Starts
June 24th: Summer Pool Party
June 21st: Intern arrival date
June 15th: Assistant Director Arrival Date
June 14th: Director's training begins
May 26th: Brainstorm day for directors
Ben gerçekten hala sadece peşin yardım için bu malzeme-sayesinde çok şey öğreniyorum!
<?php
$confirmed = 'http://schemas.google.com/g/2005#event.confirmed';
$three_months_in_seconds = 60 * 60 * 24 * 28 * 3;
$three_months_ago = date("Y-m-d\Th:i:sP", time() - 172800);
$three_months_from_today = date("Y-m-d\Th:i:sP", time() + $three_months_in_seconds);
$feed = "http://www.google.com/calendar/feeds/qp6o02ka3iaoem2kr8odga6j7s%40group.calendar.google.com/" .
"public/full?orderby=starttime&singleevents=true&" .
"start-min=" . $three_months_ago . "&" .
"start-max=" . $three_months_from_today;
$doc = new DOMDocument();
$doc->load( $feed );
$entries = $doc->getElementsByTagName( "entry" );
foreach ( $entries as $entry ) {
$status = $entry->getElementsByTagName( "eventStatus" );
$eventStatus = $status->item(0)->getAttributeNode("value")->value;
if ($eventStatus == $confirmed) {
$titles = $entry->getElementsByTagName( "title" );
$title = $titles->item(0)->nodeValue;
$times = $entry->getElementsByTagName( "when" );
$startTime = $times->item(0)->getAttributeNode("startTime")->value;
$when = date( "F jS", strtotime( $startTime ) );
$whentime = date( "g:ia", strtotime ( $startTime ) );
$places = $entry->getElementsByTagName( "where" );
$where = $places->item(0)->getAttributeNode("valueString")->value;
$links = $entry->getElementsByTagName( "link" );
$link = $links->item(0)->nodeValue;
print $when;
if ($whentime == "12:00am"){
;
}
else{
echo " at ";
print $whentime;
}
echo ": ";
echo "<b>";
print $title . "\n";
echo "</b>";
echo " ";
if(empty($where)){;}else{
echo "<br />";
print $where . "\n";
}
print $link;
print "<br />";
}
}
?>