EQdkp Plus Navigation:   Home  |   Forum  |   Wiki  |   Translate  |   Bugtracker  |   WebSVN  |  USVN

Feed

From EQdkp Plus Wiki

Information
min. EQDKP-PLUS Version 0.7.0.23



Contents

General

Init the Feed

Init once per feed.

Option Name Description
feedfilr Document location, the url to the page where the feed is
link The link to the feed
title Feed Title
description Description text
published The puplishing date
language The language of the feed, must be ISO-Style (p.e. EN-EN)
$feed			= new Feed();
$feed->feedfile		= $core->BuildLink().$pcache->FileLink('last_news.xml', 'eqdkp');
$feed->link		= $core->BuildLink();
$feed->title		= "Last News";
$feed->description	= $core->config['main_title']." EQdkp-Plus - Last News";
$feed->published	= time();
$feed->language		= 'EN-EN';

Init the Items

Required items

This is for every Item to be added to a feed. p.e. in an foreach()

Option Name Description
title Feed Title
description Description text
link Link to the Feed item
published The puplishing date
author Author of the feed item
source Link to the source
$rssitem = new feeditems();
$rssitem->title		= stripslashes(sanitize($news['news_headline']));
$rssitem->description	= $bbcode->toHTML($news['news_message'], true);
$rssitem->link		= $core->BuildLink().'viewnews.php?id='.$news['news_id'];
$rssitem->published	= $news['news_date'];
$rssitem->author	= $news['username'];
$rssitem->source	= $feed->link;
$feed->addItem($rssitem);

Additional items

You can add own fields using the additional items array. Pass it as an array, the array key will be the xml key, the array value will be the xml value.

$rssitem->customitems = array(
	'version'     		=> $arrFeed->version,
	'level'       		=> $arrFeed->releaselevel,
	'realname'    		=> $arrFeed->realname,
	'plugin'      		=> $arrFeed->shortname,
);

Generate Feed

Output

If you want to show it by your own, and not want to save it for later usage, use the show() function

$feed->show();

Save to data/ folder

Its pretty simple. Just use the save function and set the folder, and the xml will be written using the pcache.

$rssfile			= $pcache->FilePath('last_news.xml', 'eqdkp');
$feed->save($rssfile);