You can add RSS to your module easily using the icmsFeed class and the RSS template included in system module. This is the way to do it:

Call the IcmsFeed class

include_once XOOPS_ROOT_PATH.'/class/icmsfeed.php';
$myFeed = new IcmsFeed ();

Change default properties on the object if required

Properties have default values assigned upon creation of the object. Change as many values as you need, from none to all. The following is a list of properties and default values:

Property Description
$myFeed->title Site title as defined in general preferences.
$myFeed->url XOOPS_URL constant as defined in mainfile.php.
$myFeed->description Site slogan as defined in general preferences.
$myFeed->language _LANGCODE as defined in language/[your language]/global.php
$myFeed->charset _CHARSET as defined in language/[your language]/global.php
$myFeed->pubDate Defaults to 'now', formatted using _DATESTRING as defined in language/[your language]/global.php
$myFeed->category Empty by default.
$myFeed->webMaster Admin contact email as stated in general preferences.
$myFeed->generator Defaults to XOOPS_VERSION constant.
$myFeed->image Defaults to 'images/logo.gif'.
$myFeed->feeds These are the contents of the feed. Defaults to an empty array.

Populate with your own content

Fill your new icmsFeed object with the appropiate content. You have to populate the ->feeds property with a properly formatted array. The following is an example with just one news item.

$myFeed->feeds[] = array ( 'title' => 'Do androids dream with electric sheep?', 'link' => 'http://www.philipkdick.com', 'description' => 'Novel in which Blade Runner is based upon', 'pubDate' => 'Publication date here (optional)', 'guid' => 'unique identifier of the item (optional)', );

Just load your stuff into ->feeds array and you're done. Remember not to change key names in the array.

Call the render method

$myFeed->render();

That's it. Welcome to your new RSS.

Last modified on 2011/12/6 by Anonymous
Comments
The comments are owned by the poster. We aren't responsible for their content.