PHP Classes

File: rssfeed.example.php

Recommend this page to a friend!
  Classes of Cornelius Bolten   RSSFeed   rssfeed.example.php   Download  
File: rssfeed.example.php
Role: Example script
Content type: text/plain
Description: example-script how to use this package
Class: RSSFeed
Create a RSS feed in an easy way
Author: By
Last change: updated example for new usage of the whole class.
Date: 20 years ago
Size: 1,441 bytes
 

Contents

Class file image Download
<?php

   
include_once("RSSFeed.inc.php");
   
   
// create a new feed with ISO
    // or without ISO:
    // $myFeed = new RSSFeed();
    // if no ISO given, will take ISO-8859-1
   
$myFeed = new RSSFeed('ISO-8859-1');
   
   
   
$myFeed->addChannel("XML.com",
                       
"XML.com features a rich mix of information and services for the XML community.",
                       
"en",
                       
"http://www.xml.com/xml/news.rss",
                       
"Xml.com",
                       
"copyright 2003",
                       
"webmaster@xml.com");

   
   
// add an image to your XML-feed
   
$myFeed->addImage( "http://xml.com/universal/images/xml_tiny.gif",
                               
"Xml.COM",
                               
"http://www.xml.com");
                               
   
// add a new channel
   
$myFeed->addChannelLink("http://www.xml.com/xml/news.rss");

   
// add feed-items to your channel
   
$myFeed->addFeedItem( "Processing Inclusions with XSLT",
                           
"http://xml.com/pub/2000/08/09/xslt/xslt.html",
                           
"Processing document inclusions with general XML tools can be problematic. This article proposes a way of preserving inclusion information through SAX-based processing.");
   
$myFeed->addFeedItem( "Putting RDF to Work",
                           
"http://xml.com/pub/2000/08/09/rdfdb/index.html",
                           
"Tool and API support for the Resource Description Framework is slowly coming of age. Edd Dumbill takes a look at RDFDB, one of the most exciting new RDF toolkits.");

   
// and release feed. this will output wellformed XML
   
$myFeed->releaseFeed();
?>