PHP Classes
Icontem

File: rss_class.php


  Search   All class groups All class groups   Latest entries Latest entries   Top 10 charts Top 10 charts   Newsletter Newsletter   Blog Blog   Forums Forums   Help FAQ Help FAQ  
  Login   Register  
Recommend this page to a friend! ReTweet ReTweet Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Sklyuev Nickita  >  Little RSS class  >  rss_class.php  
File: rss_class.php
Role: Class source
Content type: text/plain
Description: Class Lilte RSS FEED
Class: Little RSS class
Compose and generate RSS 2.0 feeds
 

Contents

Class file image Download
<?php
// litle rss class
class rss_feed{
    
    
private $title;
    
private $desc;
    
private $host;
    
private $encode;
    
private $lang;
    
private $date
    
private $author;
    
private $generate;
    
private $head;
    
    
public function __construct($host,$title,$desc,$author,$encode="windows-1251",$lang="ru"$generate="Trilodi CMS TEAM"){
        
$this->host=$host;
        
$this->title=$title;
        
$this->desc=$desc;
        
$this->encode=$encode;
        
$this->lang=$lang;
        
$this->author=$author;
        
$this->generate=$generate;
    
    
$feed="<?xml version=\"1.0\" encoding=\"".$this->encode."\"?>\n<rss version=\"2.0\" xmlns:dc=\"http://purl.org/dc/elements/1.1/\">\n<channel>\n<title>".$this->title."</title>\n<link>".$this->host."</link>\n<language>".$this->lang."</language>\n<description>".$this->desc."</description>\n<generator>".$this->generate."</generator>";
    
$this->head=$feed;    
    return  
$this->head;
    }
    
    
public function feed($title$guid$description$category$creator$guidOn="true"$pubDate="Mon, 05 Jan 1987 18:44:39"$time_poyas="+0400"){
        
$fead_rss.="\n<item>\n";
        
$fead_rss.="<title>".$title."</title>\n";
        
$fead_rss.="<guid isPermaLink=\"".$guidOn."\">".$guid."</guid>\n";
        
$fead_rss.="<link>".$this->host."/$guid</link>\n";
        
$fead_rss.="<description>\n<![CDATA[$description]]>\n</description>\n";
        
$fead_rss.="<category><![CDATA[$category]]></category>\n";
        
$fead_rss.="<dc:creator>$creator</dc:creator>\n";
        
$fead_rss.="<pubDate>$pubDate $time_poyas</pubDate>\n";
        
$fead_rss.="\n</item>";
        return 
$fead_rss;
        
    }
    
    
public function  end_feed(){
        return 
"\n</channel>\n</rss>";
    }
    
// end class
}
// example
$class= new rss_feed("http://www.kachni.net",'Kachni.NET','The Description','Administration Kachni.NET');
$test.=$class->head;

for (
$i=1;$i<11;$i++){
$test.=$class->feed('Example news &#8470; '.$i"test#$i.html"'<center> Examle description news &#8470; '.$i."<center><hr>"$i'Administration Kachni.NET');
}

$test.=$class->end_feed();
echo 
$test;
?>

 
  Advertise on this site Advertise on this site   Site map Site map   Statistics Statistics   Site tips Site tips   Privacy policy Privacy policy   Contact Contact  

For more information send a message to :
info at phpclasses dot org.
Copyright (c) Icontem 1999-2009 PHP Classes - PHP Class Scripts
  PHP Book Reviews - Reviews of books and other products