Drop Shadow

RSS and iCal Feeds

Set up the feed like you would any PHP object. First include the file, then make the new feed. You’ll need to provide the new feed with the title and possibly description and link.

<? include_once("/web/includes/feed.phpi"); $feed = new feed('title', 'description', 'link'); ?>

Description and link are optional, but you should provide them.

Once you have the feed object, you can give it an array of items to make into the feed:

$feed->rss($items);

That will create the RSS feed for you.

You must construct the array of items yourself. Each item must itself be an array that contains a title and a publication date. They can also contain a description and a link.

Feed items

Your feed items must be in a dictionary-style array using specific keys for each RSS field.

RSS fieldarray key
titletitle
descriptiondescription
linklink
publication datetimestamp
enclosureenclosure

The publication date must be a Unix timestamp.

Feed image

If you want to give your feed an image, use the “image” method:

$feed->image($title, $url, $width, $height);

The image will be displayed for your feed in feed readers that support it.

RSS is not HTML

You cannot have HTML code inside your feed page. This will invalidate the feed. Keep all of your text inside the PHP markers. The very first line of your file should be “<?”. The very last line should be “?>”.

Using the SQL plug-in

If you are using the Easy SQL in PHP plug-in, it has some shortcuts for creating feeds using this object.