I am trying to troubleshoot a problem with a php script that incorporates an RSS feed (with Magpie 0.72.) I did not code the site, and am trying to retrace the original logic. Tech support at my web hosting firm said that the problem was in line 4 of INDEX.PHP:
1. <?php
2. require ("\\\\(HOSTING SITE NAME)\\config.inc.php");
3. require ($CONFIG['admin_dir'].'page.class.php');
4. require ($CONFIG['admin_dir'].'function.inc.php');
5. $currentFile = $_SERVER["SCRIPT_NAME"];
6. $parts = explode('/', $currentFile);
7. $currentFile = $parts[count($parts) - 1];
8. $currentFile = preg_replace("/\.\w+$/", "", $currentFile);
9. $page = new page($currentFile, $CONFIG);
10. if ( !$page->isActive() ) {
a. $currentFile = $CONFIG['404_page'];
b. $page = new page($currentFile, $CONFIG);
11. }
12. require ($CONFIG['include_dir'].$page->getTemplate().'.php');
13. ?>
The RSS feed is in an INCLUDES directory that is defined by CONFIG.INC.PHP:
<?php
# URL to the RSS feed
// CIO.com
$FEED_URL = "http://feeds.cio.com/cio/feed/articles?format=rss";
$NUM_ITEMS = 5;
require($CONFIG['include_dir'].'magpierss-0.72\rss_fetch.inc');
# Fetch the feed
error_reporting(E_ERROR);
$rss = fetch_rss($FEED_URL);
if($rss) {
# Split array with our amount of items
$items = array_slice($rss->items, 0, $NUM_ITEMS);
$rssChannelTitle = $rss->channel['title'];
$rssChannelLink = $rss->channel['link'];
// $rssChannelDesc = $rss->channel['description'];
$output = "";
$output .= "";
foreach ( $items as $item ) {
$output .= '<li class="item">';
$output .= '<a class="itemLink" target="blank" href="';
$output .= $item['link'] . '">';
$output .= $item['title'];
$output .= '</a>';
/* CIO's feed contains ads.
$output .= '<p class="description">' . $item['description'] . '</p>';
*/
$output .= "</li>";
}
$output .= "";
}
?>
<?php if($rss) { ?>
<div class="rssFeed <?php echo $rssChannelTitle ?>">
<h1>
<a href="<?php echo $rssChannelLink ?>">
<?php echo $rssChannelTitle ?>
</a>
</h1>
<!-- <h2><?php echo $rssChannelDesc ?></h2> -->
<ul class="itemList">
<?php echo $output ?>
</ul>
</div>
<?php } ?>
What am I missing?