PHP Classes

File: class_rss_test.php

Recommend this page to a friend!
  Classes of Aral Balkan   RSS 1.0 creator   class_rss_test.php   Download  
File: class_rss_test.php
Role: Example script
Content type: text/plain
Description: Test file for class_rss - creates the basic sample RSS 1.0 document in the official RSS specification document
Class: RSS 1.0 creator
RSS 1.0 creator class
Author: By
Last change:
Date: 21 years ago
Size: 1,691 bytes
 

Contents

Class file image Download
<?php
   
/*
        class_rss_test.php
        Copyright (c) 2002, Aral Balkan.

        Creates the basic sample RSS 1.0 document shown on pg.4 & 5 of the RSS 1.0
        Specification document (http://groups.yahoo.com/group/rss-dev/files/specification.html)
    */

   
require_once ("class_rss.php");

   
$myChannel = array (
       
title => "XML.com",
       
link => "http://xml.com/pub",
       
description => "XML.com features a rich mix of information and services for the XML community.",
       
url => "http://www.xml.com/xml/news.rss"
   
);

   
$myImage = array (
       
title => "XML.com",
       
link => "http://www.xml.com",
       
url => "http://xml.com/universal/images/xml_tiny.gif"
   
);

   
$myDataSource = array (
        array (
           
title => "Processing Inclusions with XSLT",
           
link => "http://xml.com/pub/2000/08/09/xslt/xslt.html",
           
description => "Processing document inclusions with general XML tools can be problematic. This article proposes a way of preserving inclusion information through SAX-based processing."
       
),
        array (
           
title => "Putting RDF to Work",
           
link => "http://xml.com/pub/2000/08/09/rdfdb/index.html",
           
description => "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."
       
)
    );

   
// create new RSS object
   
$myRSS = new RSS;

   
// populate the RSS object - these methods can be called in any order
   
$myRSS -> addDataSource( $myDataSource );
   
$myRSS -> addImage ( $myImage );
   
$myRSS -> addChannel ( $myChannel );

   
// retrieve the RSS document
   
$myRSSDoc = $myRSS->get();

   
// display RSS document
   
header("Content-Type: text/xml");
    echo
$myRSSDoc;

?>