Andy, I was able to get it to work (thanks to Julian's help) .. here's the
golden code. Postal and Phone had an extra array declaration step and the
extensions need to have an array_push applied to stack them - wouldn't have
ever figured either issue out without Julian's assistance, so thanks again
JT.
$extension = new Zend_Gdata_App_Extension_Element('email', null, '
http://schemas.google.com/g/2005');
$attributes['address'] = array('namespaceUri'=>null,'name'=>'address',
'value' => $emailaddy);
$attributes['rel'] = array('namespaceUri'=>null,'name'=>'rel', 'value' => '
http://schemas.google.com/g/2005#home');
$attributes['primary'] = array('namespaceUri'=>null,'name'=>'primary',
'value' => 'true');
$extension->setExtensionAttributes($attributes);
$entry = $gdata->newEntry();
$entry->title = $gdata->newTitle($name);
$entry->setExtensionElements(array($extension));
$extensionElements = $entry->getExtensionElements();
$extension2 = new Zend_Gdata_App_Extension_Element('postalAddress',
null, 'http://schemas.google.com/g/2005');
$attributes2 = array();
$extension2->setText($contactAddress);
$attributes2['rel'] = array('namespaceUri'=>null,'name'=>'rel', 'value'
=> 'http://schemas.google.com/g/2005#home');
$attributes2['primary'] = array('namespaceUri'=>null,'name'=>'primary',
'value' => 'true');
$extension2->setExtensionAttributes($attributes2);
array_push($extensionElements, $extension2);
$entry->setExtensionElements($extensionElements);
$extensionElements = $entry->getExtensionElements();
$extension3 = new Zend_Gdata_App_Extension_Element('phoneNumber', null,
'http://schemas.google.com/g/2005');
$attributes3 = array();
$extension3->setText($phone);
$attributes3['rel'] = array('namespaceUri'=>null,'name'=>'rel', 'value'
=> 'http://schemas.google.com/g/2005#home');
$attributes3['primary'] = array('namespaceUri'=>null,'name'=>'primary',
'value' => 'true');
$extension3->setExtensionAttributes($attributes3);
array_push($extensionElements, $extension3);
$entry->setExtensionElements($extensionElements);
$content = $gdata->newContent($comments);
$content->setType('text');
$entry->content = $content;
$entryResult = $gdata->insertEntry($entry,$mystream);
Hope that helps everyone!
Brian.
On Mon, Mar 16, 2009 at 6:50 AM, andyjimmy <[email protected]> wrote:
>
> I too like brian am struggling to make it add more than one
> 'extension' at a time. And this would seem to be the only resource out
> there on the zend framework.
>
> I have used the same code as brian for the multiple extensions, but
> the only entry that is added is the last on in the list, is there a
> way to save them as you go through them, or is there some way to batch
> add them all.
>
> Also having alittle difficulty with adding phone number and postal
> address... its the 'text()' field
> http://code.google.com/apis/gdata/elements.html#gdPhoneNumber
> as referred to here that i don't know how to get working with zend
> >
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Google Contacts 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-contacts-api?hl=en
-~----------~----~----~----~------~----~------~--~---