How to order Google Calendar feed by start date, which is sooner to the present? I tried a lot of different ways but it didn’t happened. I think there are some functions from API, but I can’t get them working. Sorry for my bad English!
Here is my code
`
function outputCalendar($client)
{
$gdataCal = new Zend_Gdata_Calendar($client);
$eventFeed = $gdataCal->getCalendarEventFeed();
$d = 0;
foreach ($eventFeed as $event):
$event->id->text = str_replace ("http://www.google.com/calendar/feeds/default/private/full/", "", $event->id->text);
$descrEvent = $event->getContent();
if(mb_strlen($descrEvent, "UTF-8") > 200)
$descrEvent = mb_substr($descrEvent, 0, 200, "UTF-8")."...";
?>
<div class="slider-container">
<span style="font-weight: bold;"><?= stripslashes($event->title->text); ?></span><br />
<span class="st">Start date: <?= date('Y-m-d', strtotime($event->when['0']->startTime)); ?></span>
<span class="et">End date: <?= date('Y-m-d', strtotime($event->when['0']->endTime)); ?></span>
<span class="st"><?= stripslashes($event->where['0']->valueString); ?></span><br />
<span class="str"><?= stripslashes($descrEvent); ?></span>
</div>
<?
$d++;
endforeach;
}
require_once 'Zend/Loader.php';
Zend_Loader::loadClass('Zend_Gdata');
Zend_Loader::loadClass('Zend_Gdata_AuthSub');
Zend_Loader::loadClass('Zend_Gdata_ClientLogin');
Zend_Loader::loadClass('Zend_Gdata_Calendar');
$user = 'killerskunk@gmail.com';
$pass = 'mr_bean';
$service = Zend_Gdata_Calendar::AUTH_SERVICE_NAME; // predefined service name for calendar
$client = Zend_Gdata_ClientLogin::getHttpClient($user,$pass,$service);
outputCalendar($client);
?>`
I’ve done it by inserting
after