Class FeedCreator

Description

Builds and renders feeds

Example:

  1.  $feed new FeedCreator(FEED_RSS'2.0');
  2.  $feed->setEncoding('iso-8859-1');
  3.  $feed->setChannelElement('title''My Site Announcements');
  4.  $feed->setChannelElement('description''This is the announcements of my site.');
  5.  $feed->setChannelElement('lastBuildDate'time());
  6.  for ($i=1$i<=10$i++{
  7.    $item new FeedItem;
  8.    $item->title "Feed item nr. {$i}";
  9.    $item->description "This is the item nr. {$i}";
  10.    $item->link "http://my.site/news/{$i}";
  11.    $feed->addItem($item);
  12.  }
  13.  $feed->downloadFeed('announcements.xml');

Located in /core/xml/feed/FeedCreator.class.php (line 62)

PHP2Go
   |
   --FeedCreator
Variable Summary
string $css
string $encoding
string $xsl
Method Summary
FeedCreator FeedCreator (string $feedType, [string $feedVersion = NULL])
void addChannelElement (string $name, mixed $value)
void addItem (FeedItem $Item)
void downloadFeed (string $fileName)
bool saveFeed (string $fileName)
void setChannelElement (string|array $name, [mixed $value = ''])
void setCssStylesheet (string $url)
void setEncoding (string $encoding)
void setXslStylesheet (string $url)
Variables
string $css (line 76)

CSS stylesheet

string $encoding (line 69)

Feed XML encoding

Feed $Feed = NULL (line 90)

Internal Feed instance

string $xsl (line 83)

XSL stylesheet

Methods
Constructor FeedCreator (line 99)

Class constructor

FeedCreator FeedCreator (string $feedType, [string $feedVersion = NULL])
  • string $feedType: Feed type
  • string $feedVersion: Format version
addChannelElement (line 156)

Adds a new entry of a channel's composite element

void addChannelElement (string $name, mixed $value)
  • string $name: Element value
  • mixed $value: Element's new entry
addItem (line 165)

Adds an item on the feed's channel

void addItem (FeedItem $Item)
downloadFeed (line 175)

Renders and displays the feed, along with the download HTTP headers

  • uses: _renderFeed()
void downloadFeed (string $fileName)
  • string $fileName: File name to be used on the response headers
saveFeed (line 191)

Renders and saves the feed on a file

  • uses: _renderFeed()
bool saveFeed (string $fileName)
  • string $fileName: File path
setChannelElement (line 141)

Defines one or more channel attributes

void setChannelElement (string|array $name, [mixed $value = ''])
  • string|array $name: Attribute name or hash of attributes and values
  • mixed $value: Attribute value
setCssStylesheet (line 122)

Defines a CSS stylesheet for the feed

void setCssStylesheet (string $url)
  • string $url: Stylesheet URL
setEncoding (line 113)

Sets the encoding of the feed XML

void setEncoding (string $encoding)
  • string $encoding: Encoding
setXslStylesheet (line 131)

Defines a XSL stylesheet for the feed

void setXslStylesheet (string $url)
  • string $url: Stylesheet URL
_renderFeeed (line 209)

Renders the feed

Creates an instance of the XmlRender class, and populates the XmlDocument with the provided properties: encoding, CSS stylesheet, XSL stylesheet, channel elements and feed items.

Returns the renderer instance, so that other methods can decide what to do with the generated XML string.

  • access: private
XmlRender &_renderFeeed ()

Inherited Methods

Inherited From PHP2Go

PHP2Go::PHP2Go()
PHP2Go::equals()
PHP2Go::generateUniqueId()
PHP2Go::getClassName()
PHP2Go::getConfigVal()
PHP2Go::getLangVal()
PHP2Go::getObjectName()
PHP2Go::getParentName()
PHP2Go::hasDestructor()
PHP2Go::hashCode()
PHP2Go::isA()
PHP2Go::isSubclassOf()
PHP2Go::logError()
PHP2Go::raiseError()
PHP2Go::registerDestructor()
PHP2Go::registerShutdownFunc()
PHP2Go::retrieve()
PHP2Go::store()
PHP2Go::__toString()

Documentation generated on Sun, 07 Oct 2007 19:24:05 -0300 by phpDocumentor 1.3.2