On Thu, Nov 20, 2008 at 6:13 PM, JakeBondo <[email protected]> wrote:
>
> I am using this code, and I want the out put to be a link to the event
> information. The problem is I have no clue how to make that happen.
> Any suggestions? Thanks!
>
>
> <?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() -
> $three_months_in_seconds);
> $three_months_from_today = date("Y-m-d\Th:i:sP", time() +
> $three_months_in_seconds);
>
> $feed = "http://www.google.com/calendar/feeds/foss.sanjuan
> %40gmail.com/" .
> "public/full?orderby=starttime&singleevents=true&" .
> "start-min=" . $three_months_ago . "&" .
> "start-max=" . $three_months_from_today;
>
> $s = simplexml_load_file($feed);
>
> foreach ($s->entry as $item) {
> $gd = $item->children('http://schemas.google.com/g/2005');
>
> if ($gd->eventStatus->attributes()->value == $confirmed) {
> ?>
> <font size=+1><b>
> <?php print $item->title; ?>
> </b></font><br>
>
> <?php
> $startTime = '';
> if ( $gd->when ) {
> $startTime =
> $gd->when->attributes()->startTime;
> } elseif ( $gd->recurrence ) {
> $startTime =
> $gd->recurrence->when->attributes()->startTime;
> }
>
> print date("l jS \o\f F Y - h:i A", strtotime(
> $startTime ) );
> // Google Calendar API's support of timezones is buggy
> print " AST<br>";
> ?>
> <?php print $gd->where->attributes()->valueString;
> ?><br>
> <br>
>
> <?php
> }
> } ?>
Events will have a <link rel="alternate" .../> element, which contains
(inside an 'href' attribute) the URL for the event. You just need to
extract this from the event entry and output this URL as a hyperlink.
See Zend_Gdata_App_FeedEntryParent::getAlternateLink():
http://framework.zend.com/apidoc/core/Zend_Gdata/App/Zend_Gdata_Calendar_EventEntry.html
http://framework.zend.com/apidoc/core/Zend_Gdata/App/Zend_Gdata_App_FeedEntryParent.html#methodgetAlternateLink
--
Trevor Johns
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Google Calendar Data API" group.
To post to this group, send email to
[email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/google-calendar-help-dataapi?hl=en
-~----------~----~----~----~------~----~------~--~---