WebSite-PHP Framework PHP
Multi language
Simple Ajax mode
No HTML, no JavaScript
URL rewriting
Mail sending
Sitemap - RSS - Web service
Download WebSite-PHP FrameWork now
 


Loading
 


Tutorial Rss-generator

Tutorials

>

Tutorial 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.


Tutorial 1 : 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, 29 Mar 2024 00:00:00 +0100</lastBuildDate>
<ttl></ttl>
<webMaster>contact@website-php.com (WebSite-PHP Framework)</webMaster>
<item>
<title>Test</title>
<link>https://www.website-php.com/</link>
<description>Test description</description>
<pubDate>Fri, 29 Mar 2024 14:30:11 +0100</pubDate>
<author>contact@website-php.com (WebSite-PHP Framework)</author>
<guid isPermaLink="true">https://www.website-php.com/</guid>
</item>
</channel>
</rss>
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), 128400);
        
        
// Creating a new feed item
        
$rssItem = new RSSFeedItem();
        
$rssItem->setTitle('Test');
        
$rssItem->setDescription('Test description');
        
$rssItem->setLink(BASE_URL);
        
$rssItem->setGuid(BASE_URLtrue);
        
$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;
    }
}
?>



Share

 


Copyright © 2009-2024 WebSite-PHP Framework PHP
Home Documentation Download Quick start Tutorials Wiki Issue Tracker