/ Published in: PHP
URL: http://css-tricks.com/snippets/php/rss-generator/
Expand |
Embed | Plain Text
<?php // Connect to database... (you'll need to create this yourself) require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/connection.php'; // Run query... FROM `rss_feed` ORDER BY `time` DESC // Output XML (RSS) echo '<?xml version="1.0" encoding="ISO-8859-1" ?> <rss version="2.0"> <channel> <title>Your RSS Title</title> <link>http://the_location_of_your_feed/feed</link> <description>Description of your Feed</description> <language>English</language> <image> <title>website Logo</title> <url></url> <link>Link to image</link> <width>width</width> <height>height</height> </image>'; while($rssFeed = mysql_fetch_array($getFeed)) { echo '<item>', '<title>', $rssFeed['item_title']</title>', '<link>', $rssFeed['link'], '</link>', '<description><![CDATA[ ,$rssFeed['description'],']]></description> </item>'; } echo '</channel> </rss>'; ?>
You need to login to post a comment.
