AnewtRssChannel Class Reference

RSS channel (feed). More...

List of all members.

Public Member Functions

 __construct ($title=null, $link=null, $description=null)
 Create a new channel object.
 add_item ($item)
 Add an AnewtRssItem to the channel.
 flush ()
 Output the channel to a browser.

Static Public Member Functions

Static helper methods
static _build_rss_element ($obj, $property, $tagname, $status, $type)
 Helper function to create RSS XML elements.

Private Member Functions

 build_document ()
 Build an XML document for this channel.

Private Attributes

 $properties
 List of properties and their specification.
 $items = array()
 List of items in this feed.


Detailed Description

RSS channel (feed).

AnewtRssChannel instances handle a number of properties , which you can set using regular AnewtContainer::set() method calls. These will end up as elements of your RSS channel.

The required properties are:

The optional properties are:

The url property can be used to set a custom URL which will be included in a atom:link element, as suggested by the FeedValidator people. The default url detection will work in most cases though, so there's usually no need to fiddle with this.

You can specify the text encoding used with the encoding property. This defaults to UTF-8. The Anewt RSS module does not do character set conversion, so you should make sure your values are in the right character set before you set them on the AnewtRssChannel and AnewtRssItem instances.

There is also a content-type property that is set to the correct MIME type, i.e. application/rss+xml. You should not override this except for testing, e.g. temporarily serving as text/html helps with debugging your feed. Even though there are lots of text/xml feeds on the web, you should really stick to application/rss+xml. No cookies for you if you change it for production use!

After setting the channel properties, you can add AnewtRssItem instances to it using AnewtRssChannel::add_item(). Finally, you output the complete channel using AnewtRssChannel::flush().

See also:
AnewtRssItem

Definition at line 75 of file rss.lib.php.


Constructor & Destructor Documentation

AnewtRssChannel::__construct ( title = null,
link = null,
description = null 
)

Create a new channel object.

For convenience, this constructor takes three parameters that must be set according to the RSS specification. If you don't set them here, you're supposed to provided them later by calling the set() method.

Parameters:
$title The channel's title (optional).
$link The channel's link (optional).
$description The channel's description (optional).

Definition at line 200 of file rss.lib.php.


Member Function Documentation

static AnewtRssChannel::_build_rss_element ( obj,
property,
tagname,
status,
type 
) [static]

Helper function to create RSS XML elements.

This is only for internal use.

Parameters:
$obj The object from which to retrieve the value
$property The property name
$tagname The XML tag name
$status Status of the element
$type Data type of the element
Returns:
An AnewtXMLDomElement instance, or null.

Definition at line 106 of file rss.lib.php.

AnewtRssChannel::add_item ( item  ) 

Add an AnewtRssItem to the channel.

Parameters:
$item A AnewtRssItem instance.

Definition at line 238 of file rss.lib.php.

AnewtRssChannel::flush (  ) 

Output the channel to a browser.

This renders the page to the browser, including the correct Content-type headers and XML prolog.

Definition at line 318 of file rss.lib.php.


Member Data Documentation

AnewtRssChannel::$properties [private]

Initial value:

 array(

                

                
                'title'           => array('title',          ANEWT_RSS_ELEMENT_STATUS_REQUIRED, ANEWT_RSS_ELEMENT_TYPE_STRING),
                'link'            => array('link',           ANEWT_RSS_ELEMENT_STATUS_REQUIRED, ANEWT_RSS_ELEMENT_TYPE_CANONICAL_URL),
                'description'     => array('description',    ANEWT_RSS_ELEMENT_STATUS_REQUIRED, ANEWT_RSS_ELEMENT_TYPE_STRING),

                
                'language'        => array('language',       ANEWT_RSS_ELEMENT_STATUS_OPTIONAL, ANEWT_RSS_ELEMENT_TYPE_STRING),
                'copyright'       => array('copyright',      ANEWT_RSS_ELEMENT_STATUS_OPTIONAL, ANEWT_RSS_ELEMENT_TYPE_STRING),
                'editor'          => array('managingEditor', ANEWT_RSS_ELEMENT_STATUS_OPTIONAL, ANEWT_RSS_ELEMENT_TYPE_STRING),
                'webmaster'       => array('webMaster',      ANEWT_RSS_ELEMENT_STATUS_OPTIONAL, ANEWT_RSS_ELEMENT_TYPE_STRING),
                'date'            => array('pubDate',        ANEWT_RSS_ELEMENT_STATUS_OPTIONAL, ANEWT_RSS_ELEMENT_TYPE_DATE),
                'build-date'      => array('lastBuildDate',  ANEWT_RSS_ELEMENT_STATUS_OPTIONAL, ANEWT_RSS_ELEMENT_TYPE_DATE),
                'generator'       => array('generator',      ANEWT_RSS_ELEMENT_STATUS_OPTIONAL, ANEWT_RSS_ELEMENT_TYPE_STRING),
                'time-to-live'    => array('ttl',            ANEWT_RSS_ELEMENT_STATUS_OPTIONAL, ANEWT_RSS_ELEMENT_TYPE_INTEGER),
                'image'           => array('image',          ANEWT_RSS_ELEMENT_STATUS_OPTIONAL, ANEWT_RSS_ELEMENT_TYPE_STRING),
        )
List of properties and their specification.

Definition at line 159 of file rss.lib.php.


The documentation for this class was generated from the following file:

Generated on Sun Aug 2 22:54:38 2009 for Anewt by  doxygen 1.5.9