Become Zend Certified

Prepare for the ZCE exam using our quizzes (web or iPad/iPhone). More info...

When you're ready get 7.5% off your exam voucher using voucher CJQNOV23 at the Zend Store

Setting Entry Data Points

Here's a summary of the Core API for Entries and Items. You should note it comprises not only the basic RSS and Atom standards, but also accounts for a number of included Extensions bundled with Zend_Feed_Writer. The naming of these Extension sourced methods remain fairly generic - all Extension methods operate at the same level as the Core API though we do allow you to retrieve any specific Extension object separately if required.

The Entry Level API for data is contained in Zend_Feed_Writer_Entry.

Table 73. Entry Level API Methods

setId() Set a unique ID associated with this entry. For Atom 1.0 this is an atom:id element, whereas for RSS 2.0 it is added as a guid element. These are optional so long as a link is added, i.e. the link is set as the ID.
setTitle() Set the title of the entry.
setDescription() Set the text description of the entry.
setContent() Set the content of the entry.
setLink() Set a URI to the HTML website containing the same or similar information as this entry (i.e. if the feed is from a blog, it should provide the blog article's URI where the HTML version of the entry can be read).
addAuthors() Sets the data for authors. The parameter is an array of arrays where each sub-array may contain the keys "name", "email" and "uri". The "uri" value is only applicable for Atom feeds since RSS contains no facility to show it. For RSS 2.0, rendering will create two elements - an author element containing the email reference with the name in brackets, and a Dublin Core creator element only containing the name.
addAuthor() Sets the data for a single author following the same format as described above for a single sub-array.
setDateCreated() Sets the date on which this feed was created. Generally only applicable to Atom where it represents the date the resource described by an Atom 1.0 document was created. The expected parameter may be a UNIX timestamp or a Zend_Date object. If omitted, the date used will be the current date and time.
setDateModified() Sets the date on which this feed was last modified. The expected parameter may be a UNIX timestamp or a Zend_Date object. If omitted, the date used will be the current date and time.
setCopyright() Sets a copyright notice associated with the feed.
addCategories() Accepts an array of categories for rendering, where each element is itself an array whose possible keys include "term", "label" and "scheme". The "term" is a typically a category name suitable for inclusion in a URI. The "label" may be a human readable category name supporting special characters (it is encoded during rendering) and is a required key. The "scheme" (called the domain in RSS) is optional but must be a valid URI. The method addCategory() allows adding a single category at a time.
setCommentCount() Sets the number of comments associated with this entry. Rendering differs between RSS and Atom 2.0 depending on the element or attribute needed.
setEnclosure() Adds an enclosure to the entry. The array parameter may contain the keys 'uri', 'type' and 'length'. Only 'uri' is required for Atom, though the others must also be provided or RSS rendering (where they are required) will throw an Exception.
setCommentLink() Seta a link to a HTML page containing comments associated with this entry.
setCommentFeedLink() Sets a link to a XML feed containing comments associated with this entry. The parameter is an array containing the keys "uri" and "type", where the type is one of "rdf", "rss" or "atom".
setCommentFeedLinks() Same as setCommentFeedLink() except it accepts an array of arrays, where each subarray contains the expected parameters of setCommentFeedLink().
setEncoding() Sets the encoding of entry text. This will default to UTF-8 which is the preferred encoding.


In addition to these setters, there are also matching getters to retrieve data from the Entry data container.

Zend Framework