The examples in the chapter 7.7 work only if you want to modify the
already existing items of a feed, but it is not possible to add new
items with it. Actually they work for every tag and namespace, but
item.
Finally I have written a new method. I subclassed Zend_Feed_Rss, and
added this method:
/**
* Adds a new <item></item> tag to the Zend_Feed_Rss object
*
* @TODO it would be better to put this under Zend_Feed_Element or
Zend_Feed_Abstract to have it for Atom feed too
*
* @param string $val The property's value.
* @return Zend_Feed_Rss
*/
public function addNewItem($val=null) {
$node = $this->_element->ownerDocument->createElement('item', $val);
$this->_element->appendChild($node);
$this->_buildEntryCache();
return new $this->_entryClassName(
null,
$this->_entries[$this->count()-1]);
}
so if you have a Zend_Feed_Rss in $feed, then you can add to it new items with
$item = $feed->addNewItem();
$item->title = 'This is the title of the item';
$item->description = 'Description';
etc.
Good to know: Finally one can get the entire modified feed with
$feed->saveXML();
Viktor
On 9/27/06, Mislav Marohnić <[EMAIL PROTECTED]> wrote:
On 9/27/06, Viktor Nagy <[EMAIL PROTECTED]> wrote:
> Is Zend_Feed part able to create a feed from (an object or an array),
> or it can only reed feeds?
I haven't yet given this a go, but try:
http://framework.zend.com/manual/en/zend.feed.modifying-feed.html