All pastes #217076 Raw Edit

Sans titre

public text v1 · immutable
#217076 ·published 2006-10-23 13:25 UTC
rendered paste body
<?php
/**
* @package
* @version  $Id:$
* @author
* @link
* @licence  http://www.gnu.org/licenses/gpl.html GNU General Public Licence, 
* 			see LICENCE file
*/

class CTfeed extends jController {

    function test ()
    {
    	$rep = $this->getResponse('rss20');
    	
    	jClasses::inc('blog~blog');

    	$blog = new blog ($this->param('id'), true);

		$rep->main->title = $blog->name;
		$rep->main->link = 'http://' . $blog->main_host . '/';
		$rep->main->description = $blog->description;

		$rep->main->image_url = 
			$blog->getSite()->getPicturesUrl() . 'avatar.png';
		$rep->main->image_title = $blog->name;
		$rep->main->image_link = 'http://' . $blog->main_host . '/';
		
		$rep->main->pubDate = $blog->date_publishing;
		$rep->main->lastBuildDate = date("c");
		$rep->main->generator = $blog->getSite()->name;
		
		foreach ($blog->getArticles() as $article)
		{
			$item = new jRSSItem ();
			
			$item->title = $article->title;
			$item->link  = 
				'http://' . $blog->main_host . '/' .
				'article-' . $article->reference . '.html';
			$item->description  = 
				substr (strip_tags ($article->text), 0, 300) . '...';
			$item->pubDate = $article->date_publishing;
			$item->guid  = 
				'http://' . $blog->main_host . '/' .
				'article-' . $article->reference . '.html';
				
			$rep->addItem ($item);
		}
		
		return $rep;		
    }
}

?>