Posted By

stuntsnippets on 07/24/10


Tagged

php rss


Versions (?)

Who likes this?

8 people have marked this snippet as a favorite

luman
osirisinternet
convergine
kairog
manavecplan
ninjacharlee
adth
ringo380


Generate RSS with PHP


 / Published in: PHP
 

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

  1. <?xml version="1.0" encoding="utf-8"?>
  2. <rss version="2.0">
  3. <channel>
  4. <title>PHP generate RSS feed</title>
  5. <link>http://example.com/</link>
  6. <description>PHP generate RSS feed</description>
  7. <language>de-de</language>
  8. <copyright>Copyright (C) <?php echo date('Y'); ?> example.com</copyright>
  9. <?php
  10. $params = array('newest' => true, 'limit' => '0,10', 'where' => '1=1', 'order' => 'id DESC');
  11.  
  12. //procedure for getting entities for your PHP generated RSS
  13. $listOfEntities = getList( $params );
  14.  
  15. foreach($listOfEntities as $entity) :
  16. ?>
  17.  
  18. <item>
  19. <title><?php echo $entity['title']; ?></title>
  20. <description><?php echo $entity['description']; ?></description>
  21. <link>http://example.com/<?php echo $entity['url']; ?></link>
  22. </item>
  23. <?php
  24. endforeach;
  25. ?>
  26. </channel>
  27. </rss>

Report this snippet  

You need to login to post a comment.