peranha Posted September 23, 2008 Share Posted September 23, 2008 I have this in an htaccess file with this in it AddType application/x-httpd-php .xml I have AllowOverride All set in my apache config file. I am trying to set xml files to process as php for a dynamic rss feed. Here is my code, and it does not work, not sure why. <?php header('Content-type: text/xml'); ?> <?php require ("../includes/vital.php"); ?> <rss version="2.0"> <channel> <title>peranha.dyndns.org</title> <description>Peranhas Test Website</description> <link>http://peranha.dyndns.org/</link> <copyright>Copyright Peranha</copyright> <?php // open connection $connection = mysql_connect($server, $user, $pass) or die ("Unable to connect!"); // select database mysql_select_db($db) or die ("Unable to select database!"); $query = "SELECT commid, subject, comment, datestamp, timestamp FROM feed ORDER BY commid DESC LIMIT 0,15"; $result = mysql_query($query) or die (mysql_error()); if (mysql_num_rows($result) > 0) { while($row = mysql_fetch_row($result)) { ?> <item> <title> <?php echo htmlentities(strip_tags($row['1'])); ?></title> <description> <?php echo htmlentities(strip_tags($row['2'],'ENT_QUOTES')); ?></description> <link>http://peranha.dyndns.org/test.php?id=<?php echo $row['0']; ?></link> <pubDate> <?php echo $row['3'] . " " . $row['4']; ?></pubDate> </item> <?php } } // close connection mysql_close($connection); ?> </channel> </rss> If I save it as a php file, it will display fine. PS, I have reset the apache server. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.