Home » Docs » FeedWriter

FeedWriter

FeedWriter Class Description

The FeedWriter class includes most of the core functionality used by Php FeedWriter to generate a feed. Functions are provided for each type of information that can be added to a feed. Feed and XML outputs are controlled by the FeedConstruct class.

FeedWriter Class Functions & Members

Class Constructor

Feed Data Input Functions

Add data to the feed / channel.

Class Constructor Instantiates an object from the FeedWriter class, which requires some basic information about the feed be passed as parameters to the constructor.
set_cloud() Associates the feed with a cloud connection.  Not applicable for all feed output formats.
set_icon() Associate an icon or thumbnail image with the feed.  Many feed readers / aggregators use this as a graphical representation of the feed in addition to the title and other common information.
set_image() Associate an image with the feed.
set_input() Provide details for an input field associated with the feed, such as a search box that directs the user to a results page on the main website.  This functionality is only supported by some feed output formats.
set_language() Set the language of the feed.  This may be used by some feed readers to filter or group your feed with others in the same language.
set_rating() PICS Rating for the feed.
set_refreshInterval() Refresh interval tells readers how long to wait before checking if your feed has been updated.
set_skipDays() Specify days of the week for readers to skip checking for an update.
set_skipHours() Specify specific hours in a day for readers to not check for updates.
set_webmaster() Specify details about the webmaster or contact for technical issues with the feed.
add_item() The function used to add an item to the feed.  After this function has been called at least once, the functions in the table below will associate the data passed with the most recent item added to the feed.

Item / Feed Data Input Functions

Add data to the feed if no items have been added, or to the most recent item if the add_item() function has been called previously.

add_category() Associate one or more categories with the feed, or most recently added feed item.
add_contributer() Add one or more contributes to the feed or most recently added feed item.
add_link() Add a link to the feed or most recently added item.  The type of link is passed as a parameter to the function.  See also set_selfLink() to include a URI to the current feed or item.
set_author() Include details of the feed or item author.
set_copyright() Include copyright details with the feed or most recently added feed item.  If adding to the feed, this will override defaults.  This is not related to the Php FeedWriter footer item functionality.
set_date() Associate a date with the feed or most recently added feed item.  Specify which type of date (updated, creation/publish) as a parameter.  The set_date() function accepts ISO-8601 format date regardless of the output format.
set_docs() Specify a URL to the schema documentation and information about the feed output format.  This value is predefined in the FeedConstruct class for each output format.
set_id() Override the default ID (feed or item link) which the value passed to the function.
set_selfLink() Set the URI to the current feed or item.

Item Data Input Functions

Adds data to the most recent item.

add_media() Associate media (image, video, file) with the feed item.
set_comments() Associate a URL to a page on the internet where comments can be made about the content within a feed item.
set_source() Associate a source feed with the current item.  This can be used by feed aggregators to associate information and properties from the original feed when it is being combined with items from other feeds, or published in an aggregated feed.
set_summary() A summary of the feed item content

Feed Output Functions

Adds specifications for output. Outputs the feed content in the specified format.

add_feedStylesheet() Associate one or more stylesheets with the feed.
add_feedXMLNameSpace() Add one or more custom name spaces to the feed
getFeedFormats() Returns a list of all possible Feed Output Formats.  Useful when generating links to your feed for output in different formats.
getXML() Returns the Feed XML in the specified format.
listConstructs() Lists the constructs that make up the specified feed output format.
set_feedConstruct() Sets the current feed construct / output format.  This is required for cases where you need to manipulate one or more constructs dynamically prior to output.
writeConstruct() An internal function used to write an XML element using data from the supplied construct.  Nested calls for “child” constructs are incorporated into the function.
writeToFile() Outputs the feed to a file, instead of sending directly to the browser.  This may be useful if you need to cache a feed for cases where heavy processing and/or a large amount of data is to be read from a database/disk.
Internal Use, Depreciated
add_element() No longer implemented

XML Configuration & Feed Validation Functions

invalidFeed() Used internally when data added to a feed to item is not sufficient to allow the specified feed format to be valid. This method displays details of the missing or invalid data to assist with configuring a feed that can be outputted in each format.  Feed Validation can also be disabled if required.
validate() This function validates the feed in it’s current state with the specified output format.
validateConstruct() Used internally to validate data added to the feed or an item with the construct in the corresponding feed output format.

Class Dependencies

The FeedWriter class is dependent on the FeedConstruct class. Neither class is an extension of the other, but both have been developed to work together when validating and generating a feed in a particular format. To control output of the feed, use the FeedConstruct class.

Comments (0)

No comments yet

Leave a Reply

You must be logged in to post a comment.
  • Php FeedWriter (c) Copyright 2011 Daniel Soutter. Php FeedWriter and the information on this site has been designed to benefit website developers, owners and users, but may contain errors and is provided as is, with no warranty. Terms.