When posting to Blogger, it's useful to organize your posts using using labels. When using the normal Blogger interface, this is done by adding a comma-separated list of labels to a text field at the bottom of the post. To achieve the same effect using the Blogger API, add an individual <atom:category>
element for each label to your post's entry. Set the scheme to 'http://www.blogger.com/atom/ns#'
, and set the term to your desired label.
For example, the following code for the Zend_Gdata PHP client library would add the labels "foo" and "bar" to a post (stored in $entry
):
$label1 = new Zend_Gdata_App_Extension_Category( 'foo', 'http://www.blogger.com/atom/ns#'); $label2 = new Zend_Gdata_App_Extension_Category( 'bar', 'http://www.blogger.com/atom/ns#'); $entry->setCategory(array($label1, $label2));