Quote:
|
Originally Posted by Pimpen 2010
So I always have to update the RSS Feed file? There isn't anything that does it automatically for me?
|
You could do something like this. You would need to customize the items to fit your data. This is assuming all your feed data in in a database.
=========================================
<?
header('Content-type: text/xml');
?>
<rss version="2.0">
<channel>
<title>Name of your site</title>
<description>A description of your site</description>
<link>http://your_home_page_url/</link>
<copyright>Your copyright information</copyright>
<?
$getItems="SELECT id,title,body,UNIX_TIMESTAMP(datePub)
AS pubDate LIMIT 0,8 ORDER BY pubDate DESC";
$doGet=mysql_query($getItems);
while($item=mysql_fetch_array('$doGet'))
{
$id=$doGet['id'];
$title=strip_tags($doGet['title']);
$body=strip_tags($doGet['body']);
$body=substr($doGet['body'],0,150));
$pubDate=strftime("%a, %d %b %Y %T %Z",$doGet['pubDate']);
// output to browser
?>
<item>
<title><?print htmlentities($title,'ENT_QUOTES');?></title>
<description><?print htmlentities($body,'ENT_QUOTES');?></description>
<link>http://your_url/path/and_page.php?article=<?print $id;?></link>
<pubDate><?print $pubDate;?></pubDate>
</item>
<?
}
?>
</channel>
</rss>
=========================================
imaginemn