hi, i can't make a rss feed. I don't know where the problem is. This is my code:
but when i open that .xml file in safari nothing appeared. I listened in google that i must turn on parser, something like this in .htaccess :PHP Code:<?php header('Content-type: text/xml'); ?>
<?php
@include_once("./cfg.inc.php");
$link = mysql_connect($DBSERVER, $DBUSER, $DBPASS)
or die("Can't connect" );
mysql_select_db($DB, $link) or die ("Can't select DB");
?>
<rss version="2.0">
<channel>
<title>Title</title>
<description>Description</description>
<link>Link</link>
<?php
$query= mysql_query("SELECT `id`, `title`, UNIX_TIMESTAMP(`date`), `description` FROM `rss` ORDER BY `date` DESC LIMIT 0,25");
while($result = mysql_fetch_array($query)){
?>
<item>
<title> <?php htmlentities(strip_tags($result['title'])); ?></title>
<description> <?php htmlentities(strip_tags($result['description'],'ENT_QUOTES'));?></description>
<link>http://mysite.com/news/?id=<?php $result['id'];?></link>
<pubDate> <?php strftime( "%a, %d %b %Y %T %Z" , $result['date']); ?></pubDate>
</item>
<?php } ?>
</channel>
</rss>
but when i add this string to htaccess and then open my site, ordinary page and a my xml rss file, but they just was download, when i open they. I don't know how to make my php code work in that xml file. Please help me. Thanks.PHP Code:AddType application/x-httpd-php .php .xml


Reply With Quote

Bookmarks