Code Monkey |
04-08-2006 02:00 AM |
Without really looking over the code yet.
Cut the tabs bit. You need to code it flush to the left. xml will indent itself when read in a reader, but it can't process those tabs.
You have
PHP Code:
echo "</channel>\r\n"; echo "</rss>";
In the loop. It needs to be outside the loop.
Try this.
PHP Code:
<?php
// ####################### SET PHP ENVIRONMENT ########################### error_reporting(E_ALL & ~E_NOTICE);
// #################### DEFINE IMPORTANT CONSTANTS ####################### define('SESSION_BYPASS', 1); define('LOCATION_BYPASS', 1); define('DIE_QUIETLY', 1); define('THIS_SCRIPT', 'external');
// ################### PRE-CACHE TEMPLATES AND DATA ###################### // get special phrase groups $phrasegroups = array();
// get special data templates from the datastore $specialtemplates = array();
// pre-cache templates used by all actions $globaltemplates = array();
// pre-cache templates used by specific actions $actiontemplates = array();
// ######################### REQUIRE BACK-END ############################ define('DIR', dirname(dirname(__FILE__))); //how many dirname calls depends on location of file. chdir(DIR); require_once DIR . '/global.php';
// ####################################################################### // ######################## START MAIN SCRIPT ############################ // #######################################################################
$threads = $db->query_read("select * from " . TABLE_PREFIX . "site_news ");
header('Content-Type: text/xml'); header('Expires: ' . gmdate('D, d M Y H:i:s') . ' GMT'); header('Cache-Control: must-revalidate, post-check=0, pre-check=0'); header('Pragma: public');
$output = '<?xml version="1.0" encoding="' . $stylevar['charset'] . '"?>' . "\r\n";
# Each specs shared code is entered in full (duplicated) to make it easier to read $output .= "<rss version=\"2.0\">\r\n"; $output .= "<channel>\r\n"; $output .= "<title>RSS Feeds From Sim 2 World</title>\r\n"; $output .= "<link>" . $vbulletin->options['homeurl'] . "</link>\r\n"; $output .= "<description><![CDATA[" . htmlspecialchars_uni($vbulletin->options['description']) . "]]></description>\r\n"; $output .= "<language>$stylevar[languagecode]</language>\r\n"; $output .= "<pubDate>" . gmdate('D, d M Y H:i:s', TIMENOW) . " GMT</pubDate>\r\n"; $output .= "<generator>Sim 2 World</generator>\r\n"; $output .= "<ttl>60</ttl>\r\n"; // list returned threads while ($thread = $db->fetch_array($threads)) { $output .= "<item>\r\n"; $output .= "<title>$thread[newstitle]</title>\r\n"; $output .= "<link>" . $vbulletin->options['homeurl'] . "?news_id=$thread[newsid]</link>\r\n"; $output .= "<pubDate>" . $thread['date'] . " </pubDate>\r\n"; $output .= "<description><![CDATA[". $thread['newsartcle'] ."]]></description>\r\n"; # this bit is obtuse $output .= "<author><![CDATA[(" . $thread['newsauthor'] . ")]]></author>\r\n"; $output .= "<guid isPermaLink=\"false\">" . $vbulletin->options['homeurl'] . "?news_id=$thread[newsid]</guid>\r\n"; $output .= "</item>\r\n"; } $output .= "</channel>\r\n"; $output .= "</rss>"; echo $output; ?>
|