<?php
// required files inclusion
require_once 'rss.class.php';
// creating an object
try {
//Rss class settings
$rss->setdbCallback(array('Rss', 'getMysqliData')); // We will use MySQL 4.1+ for data storage along with Rss class mysqli handler
$rss->setTitle('Finweblog');
$rss->setLink('http://weblog.finwe.info');
$rss->setDescripton('Finweblog - Matěj Finwe Humpál - Webdesign, Turistika, Muzika');
$rss->setLanguage('cs');
$rss->setImage('');
// adding Namespace for custom tags
$rss->addNamespace('xmlns:wfw','http://wellformedweb.org/CommentAPI/');
$rss->addNamespace('xmlns:dc','http://purl.org/dc/elements/1.1/');
// adding custom Channel subelements
$rss->setDbHost('localhost');
$rss->setDbUser('name');
$rss->setDbPass('pass');
$rss->setDbName('name');
$rss->setDbPort('3307');
$rss->setDbSql("SELECT id, seo_url, title, perex, timestamp, gr
FROM blog WHERE status = 'published'
ORDER BY timestamp DESC
LIMIT 15");
//each line for each table value
$rss->setDbFields(array(
// variable for usage in tag LINK. for more variables, see advanced example @example rss-comments.php
'link' => 'seo_url',
'title' => 'title',
'description' => 'perex',
// variable for usage in tag COMMENTS. for more variables, see advanced example @example rss-comments.php
'comments' => 'id',
'category' => 'gr',
// pubDate is expected to be UNIX_TIMESTAMP!!!
'pubDate' => 'timestamp',
// Example of custom tag.
// 'wfw:commentRSS' => 'id', // for one static value
// 'wfw:commentRSS' => array(array('id','seo_url'),'http://weblog.finwe.info/rss-comments.php?id=%s&%s') // for multiple variables
'wfw:commentRSS' => array('id','http://weblog.finwe.info/rss-comments.php?id=%s') // for one variable
));
// These variable %s-es will be replaced by table-varables
$rss->setPostLink('http://weblog.finwe.info/item/%s');
$rss->setCommentsLink('http://weblog.finwe.info/rss-comments.php?id=%s');
// All set, display feed
//Catch exceptions in case of some malfunction
} catch (Exception $e) {
echo '<pre>';
echo $e->getMessage() . '<br/>' . $e->getTraceAsString();
echo '</pre>';
}
?>