Login   Register  
PHP Classes
elePHPant
Icontem

File: sample_rss.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Tom Schaefer  >  QXML  >  sample_rss.php  >  Download  
File: sample_rss.php
Role: Example script
Content type: text/plain
Description: Sample RSS Feed
Class: QXML
XML <> Array (preserve attrib.), JSON, etc.
Author: By
Last change: - eliminating minor typo error
- adding header content-type
Date: 2008-05-19 05:01
Size: 2,682 bytes
 

Contents

Class file image Download
<?php
include("QXml.class.php");

$feeds = array(
        
"rss" => array(
            
"@attributes" => array("version" => 2.0),
            
"link" => array(
                
"@attributes" => array(
                    
"rel" => "alternate",
                    
"type" => "application/rss+xml",
                    
"title" => "RSS",
                    
"href" => "http://www.example.net/feed.rss"
                
),
            ),
            
"channel" => array(
                
"title" => array("@textNode" => "Your RSS Feed Title"),
                
"link" => array("@textNode" => "your-link-to-the-feed"),
                
"description" => array("@textNode" => "Short description of the feed"),
                
"language" => array("@textNode" => "Author of the feed"),
                
"pubDate" => array("@textNode" => date("Y-m-d H:M:S")),
                
"image" => array("@textNode" => "url-to-image"),
                
"item" => array(
                    
=> array(
                        
"title" => array("@textNode" => "Lorem Ipsum"),
                        
"description" => array("@textNode" => "Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum."),
                        
"link" => array("@textNode" => "http://www.lipsum.com/"),
                        
"author" => array("@textNode" => "Thomas Schaefer"),
                        
"guid" => array("@textNode" => "guid_" md5(rand()))
                    ),
                    
=> array(
                        
"title" => array("@textNode" => "Lorem Ipsum"),
                        
"description" => array("@textNode" => "Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum."),
                        
"link" => array("@textNode" => "http://www.lipsum.com/"),
                        
"author" => array("@textNode" => "Thomas Schaefer"),
                        
"guid" => array("@textNode" => "guid_" md5(rand()))
                    ),
                    
                )
            ),
        )
);

header("content-type:text/xml");
$xml = new QXML;
$xml->noCDATA();
$xml->toXML($feeds);
echo 
$xml->asXML();

?>