|
Rss-generator-01: Tutoriel du composants Rss-generator du FrameWork PHP 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_fr.png</url>
<title>WebSite-PHP Framework PHP</title>
<link>https://www.website-php.com/</link>
<width>128</width>
<height>400</height>
</image>
<lastBuildDate>Sat, 23 Nov 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>Sat, 23 Nov 2024 11:40:49 +0100</pubDate>
<author>admin@website-php.com (WebSite-PHP Framework)</author>
<guid isPermaLink="true">https://www.website-php.com/</guid>
</item>
</channel>
</rss>
|
Retourner aux tutoriels du composants Rss-generator
|
Pour utiliser Rss-generator vous devez vous connecter à l'interface administrateur du framework WebSite-PHP. Une fois connecté vous devrez aller dans le menu configuration -> Configurer modules et activer le module Rss-generator. Fichier: /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; } } ?>
Retourner aux tutoriels du composants Rss-generator
|
|
|
|
|