PHP Classes

File: feed_generator/example_minimum.php

Recommend this page to a friend!
  Classes of Jill Lingoff   Sweeper   feed_generator/example_minimum.php   Download  
File: feed_generator/example_minimum.php
Role: Example script
Content type: text/plain
Description: Example script
Class: Sweeper
Clean HTML to remove unwanted tags and attributes
Author: By
Last change:
Date: 5 years ago
Size: 1,315 bytes
 

Contents

Class file image Download
<?php
 
// This is a minimum example of using the class
 
include("FeedWriter.php");
 
 
//Creating an instance of FeedWriter class.
 
$TestFeed = new FeedWriter(RSS2);
 
 
//Setting the channel elements
  //Use wrapper functions for common channel elements
 
$TestFeed->setTitle('Testing & Checking the RSS writer class');
 
$TestFeed->setLink('http://www.ajaxray.com/projects/rss');
 
$TestFeed->setDescription('This is test of creating a RSS 2.0 feed Universal Feed Writer');
 
 
//Image title and link must match with the 'title' and 'link' channel elements for valid RSS 2.0
 
$TestFeed->setImage('Testing the RSS writer class','http://www.ajaxray.com/projects/rss','http://www.rightbrainsolution.com/images/logo.gif');
 
   
//Retriving informations from database addin feeds
   
$db->query($query);
   
$result = $db->result;

    while(
$row = mysql_fetch_array($result, MYSQL_ASSOC))
    {
       
//Create an empty FeedItem
       
$newItem = $TestFeed->createNewItem();
       
       
//Add elements to the feed item
       
$newItem->setTitle($row['title']);
       
$newItem->setLink($row['link']);
       
$newItem->setDate($row['create_date']);
       
$newItem->setDescription($row['description']);
       
       
//Now add the feed item
       
$TestFeed->addItem($newItem);
    }
 
 
//OK. Everything is done. Now genarate the feed.
 
$TestFeed->genarateFeed();
 
?>