Return to Snippet

Revision: 29269
at July 24, 2010 05:27 by stuntsnippets


Initial Code
<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0">
    <channel>
        <title>PHP generate RSS feed</title>
        <link>http://example.com/</link>
        <description>PHP generate RSS feed</description>
        <language>de-de</language>
        <copyright>Copyright (C) <?php echo date('Y'); ?> example.com</copyright>
<?php
	$params = array('newest' => true, 'limit' => '0,10', 'where' => '1=1', 'order' => 'id DESC');
 
	//procedure for getting entities for your PHP generated RSS
	$listOfEntities = getList( $params );
 
	foreach($listOfEntities as $entity) :
?>	
 
	<item>
            <title><?php echo $entity['title']; ?></title>
            <description><?php echo $entity['description']; ?></description>
            <link>http://example.com/<?php echo $entity['url']; ?></link>
        </item>
<?php
	endforeach;
?>
    </channel>
</rss>

Initial URL
http://stuntsnippets.com/php-generate-rss/

Initial Description

                                

Initial Title
Generate RSS with PHP

Initial Tags
php

Initial Language
PHP