Hi folks,
I am still quite new here, and brand new to Zend and PHP, so please forgive my ignorance...I'm sadly still very much a paint by numbers hack. :-D

I'm wanting to do what I think is a fairly simple task:

Collect info from one of my google calendars via the API and display that info in a table on a page on my website.

I have succesfully installed Zend and I have used this code to access my google calendar:

<?php
    // load library
    require_once 'Zend/Loader.php';
    Zend_Loader::loadClass('Zend_Gdata');
    Zend_Loader::loadClass('Zend_Gdata_ClientLogin');
    Zend_Loader::loadClass('Zend_Gdata_Calendar');
    Zend_Loader::loadClass('Zend_Http_Client');

    // create authenticated HTTP client for Calendar service
    $gcal = Zend_Gdata_Calendar::AUTH_SERVICE_NAME;
    $user = "EMAIL@GMAIL.COM";
    $pass = "XXXXXXXXX";
    $client = Zend_Gdata_ClientLogin::getHttpClient($user, $pass, $gcal);
    $gcal = new Zend_Gdata_Calendar($client);

    // generate query to get event list
    $query = $gcal->newEventQuery();
    $query->setUser('default');
    $query->setVisibility('private');
    $query->setProjection('basic');

    // get and parse calendar feed
    // print output
    try {
      $feed = $gcal->getCalendarEventFeed($query);
    } catch (Zend_Gdata_App_Exception $e) {
      echo "Error: " . $e->getResponse();
    }
    ?>
    <h1><?php echo $feed->title; ?></h1>
    <?php echo $feed->totalResults; ?> event(s) found.
    <p/>
    <ol>

    <?php
    foreach ($feed as $event) {
      echo "<li>\n";
      echo "<h2>" . stripslashes($event->title) . "</h2>\n";
      echo stripslashes($event->summary) . " <br/>\n";
      echo "</li>\n";
    }
    echo "</ul>";
    ?>

This gives me my default calendar information, but:
1) I want to be able to choose which calendar to display.
2) I want to be able to display the information in different columns, etc

Anyone able to point me in the right direction?

Thanks for your time!
Joel

Change $query = $gcal->newEventQuery()
to
$query = $gcal->newEventQuery( $FEEDURL)

where $FEEDURL is the private link from GCal.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.