2008年12月5日星期五

Re: [fw-gdata] Google Base - how to set the publishing priority?

Hi mike,

On Fri, Dec 5, 2008 at 3:49 PM, mikevoyt <mikevoyt@gmail.com> wrote:

Hello,

I'd like to set the publishing priority when inserting a data item into an
items feed.  The publishing priority is described here:

http://code.google.com/apis/base/starting-out.html#PubPriority

It uses the Metadata namespace ("gm:") to set this.

However, I don't any methods in the Zend_Gdata package to explicitly set
this.

Can anyone advise on how to set the publishing priority, either using an
existing method, or a way to manually insert a "gm:" attribute into the data
item?

You can insert the element manually using the Zend_Gdata_App_Extension_Element class.  It's a bit cumbersome, but possible.

I just made a post about this on our tips blog in response to your question:
http://gdatatips.blogspot.com/2008/12/creating-extension-elements-in-php.html

Here's some code:
<?php
require_once 'Zend/Gdata/Gbase.php';
require_once 'Zend/Gdata/App/Extension/Element.php';

$base = new Zend_Gdata_Gbase();

$entry = $base->newItemEntry();
$control = $base->newControl(); // Zend_Gdata_App_Extension_Control
$control->extensionElements = array(
  new Zend_Gdata_App_Extension_Element('gm:publishing_priority', 'gm', 'http://base.google.com/ns-metadata/1.0', 'high')
);
$entry->control = $control;

echo $entry->saveXML();
?>

I also created an issue for adding this element in the ZF issue tracker:
http://framework.zend.com/issues/browse/ZF-5171

Cheers,
-Ryan






Thanks!

-mike


--
View this message in context: http://www.nabble.com/Google-Base---how-to-set-the-publishing-priority--tp20864713p20864713.html
Sent from the Zend gdata mailing list archive at Nabble.com.


没有评论: