|
Rss-generator-01: Tutorial of the composant Rss-generator of the PHP FrameWork WebSite-PHP. Simple RSS:
<rss version="2.0">
<channel>
<title>WebSite-PHP Framework PHP</title>
<link>https://www.website-php.com/</link>
<description>WebSite-PHP est un FrameWork PHP 100% objet. Plus besoin de connaître le HTML, il suffit d'instancier les bons objets.</description>
<pubDate>Wed, 01 Aug 2007 00:00:00 +0200</pubDate>
<image>
<url>https://www.website-php.com/img/logo_128x400_en.png</url>
<title>WebSite-PHP Framework PHP</title>
<link>https://www.website-php.com/</link>
<width>128</width>
<height>400</height>
</image>
<lastBuildDate>Fri, 06 Dec 2024 00:00:00 +0100</lastBuildDate>
<ttl></ttl>
<webMaster>admin@website-php.com (WebSite-PHP Framework)</webMaster>
<item>
<title>Test</title>
<link>https://www.website-php.com/</link>
<description>Test description</description>
<pubDate>Fri, 06 Dec 2024 17:52:50 +0100</pubDate>
<author>admin@website-php.com (WebSite-PHP Framework)</author>
<guid isPermaLink="true">https://www.website-php.com/</guid>
</item>
</channel>
</rss>
|
Go back to tutorial of the componant Rss-generator
|
To use Rss-generator, you need to connect to the admin interface of the framework WebSite-PHP. Once connected you will go to the menu Configuration -> Configure modules and enable the module Rss-generator. File: /pages/tutorials/rss-generator/rss-generator-01.php
<?php // Use: http://YOUR_DOMAIN/tutorials/rss/rss-01.xml
class RssGenerator01 extends Page { public function InitializeComponent() { parent::$PAGE_TITLE = "Simple RSS"; // Create the new instance of the RSS Feed $rssFeed = new RSSFeed('utf-8'); // Activate the string protection $rssFeed->setProtectString(true); // Set the feed title $rssFeed->setTitle(__(SITE_NAME)); // Set the feed description $rssFeed->setDescription(__(SITE_DESC)); // Set the feed link $rssFeed->setLink(BASE_URL); // Set the feed publication date $rssFeed->setPubDate('2007-08-01'); // Set the feed last build date $rssFeed->setLastBuildDate(date('Y-m-d')); // Set the feed webmaster $rssFeed->setWebMaster(__(SMTP_MAIL), __(SMTP_NAME)); // Set the feed managing editor $rssFeed->setManagingEditor(__(SMTP_MAIL), __(SMTP_NAME)); // Set the feed image $rssFeed->setImage($this->getBaseURL()."img/". "logo_128x400_".$this->getLanguage().".png", __(SITE_NAME), $this->getBaseURL(), __(SITE_DESC), 128, 400); // Creating a new feed item $rssItem = new RSSFeedItem(); $rssItem->setTitle('Test'); $rssItem->setDescription('Test description'); $rssItem->setLink(BASE_URL); $rssItem->setGuid(BASE_URL, true); $rssItem->setAuthor(__(SMTP_MAIL), __(SMTP_NAME)); $rssItem->setPubDate(date('Y-m-d H:i:s')); // Add the item to the feed $rssFeed->appendItem($rssItem); $this->render = $rssFeed; } } ?>
Go back to tutorial of the componant Rss-generator
|
|
|
|
|