demo
templates
install
contact
Home Help XML

XML

As of version v.971rc1 080604, Contentor will create and include XML-formatted content.


Generate XML

To output XML, simply add ".xml" to any page produced by "index" or "podcast". Output from the "index" script is in RSS format. Output from the "podcast" script is in iTunes format.

Including XML

XML generated by other scripts or other sites can be included in a Contentor page using the "xml" BBCode tag.

[xml=FormName]http://address.of/feed[/xml]

"FormName" is HTML stored in the "setup" table similar to the "[form]" tag.

Field use in "setup" table:

$ttl = 1200; // time in seconds between cache refreshes - this should probably be at least 5 minutes (300 seconds). If $ttl is not specified, it is set to the constant value "_xml_cache_ttl" as specified in the system setup (util/config.inc.php).
$tags = array('tag', 'tag', 'tag', 'tag',...);  // the XML tags to extract. The special '{tag}' tag, (including the curly brackets) indicates nested tags that need further processing by extracting the following tags. (example to follow...) As each level of nested tags is extracted, the extraction routine is repeated with the form "FormName_tag" - if that form exists, the extracted values are substituted into the form HTML. Sub-forms can hasve their own $tags array for further processing. Since the routine is recursive, data processed in during sub-form processing is still in the data array for higher levels.

More details will follow... basically, the entire XML files is loaded into an array, with a typical starting array having elements such as "$data[rss][channel][title] = 'Feed title'"
In the first form, the "$tags" array would contain "'rss', 'channel', 'item'". To extract the feed title shown above, the form "FormNmae_channel" would contain "$data[title]" in the HTML where the title is to be shown.

A further explanation will be given as soon as the details are settled.

A default "xml_rss" form with "xml_rss_item" sub-form will be used if no other form is specified or if the XML feed is specified in the [include] tag.


"Cleaned" URL

For HTML-output forms and the HTML cache, a "cleaned" version of the URL is used. The "http://" and any query string are dropped and all "non-word" characters are replaced with underscores, so that "http://address.of/feed?id=1" becomes "address_of_feed"

The cache is stores in the "contents" table as "/xml_cache/address_of_feed"