PHP Classes
elePHPant
Icontem

File: index.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of MatheW  >  Feed Generator  >  index.php  >  Download  
File: index.php
Role: Example script
Content type: text/plain
Description: Example index.php
Class: Feed Generator
Generate feeds in Atom or RSS formats
Author: By
Last change:
Date: 7 years ago
Size: 775 bytes
 

Contents

Class file image Download
<?php
try {
    include(
'FeedGenerator.php');
   
$feeds=new FeedGenerator;
   
$feeds->setGenerator(new RSSGenerator); # or AtomGenerator
   
$feeds->setAuthor('mail@example.com');
   
$feeds->setTitle('Example Site');
   
$feeds->setChannelLink('http://example.com/rss/');
   
$feeds->setLink('http://example.com');
   
$feeds->setDescription('Description of channel');
   
$feeds->setID('http://example.com/rss/');

   
$feeds->addItem(new FeedItem('http://example.com/news/1', 'Example news', 'http://example.com/news/1', '<p>Description of news</p>'));
   
$feeds->addItem(new FeedItem('http://example.com/news/2', 'Example news', 'http://example.com/news/2', '<p>Description of news</p>'));

   
$feeds->display();
}
catch(
FeedGeneratorException $e){
    echo
'Error: '.$e->getMessage();
}
?>