RSS problem
Posted: Fri Mar 25, 2011 11:31 am
I am working on a PHP coded website with an embedded RSS function that is not working. I found [sourcename]-rss.php files in the ‘Includes” directory and updated the feed information to valid feeds, but I am not sure where I need to look for the pointers to those files. The site uses Magpie as a feed parser.
The feed is on every page of the site. The Main CSS has is coded as
div.rssFeed {}
div.rssFeed h1 { display: none;}
div.rssFeed h2 { display: none;}
div.rssFeed ul.itemList {}
div.rssFeed ul.itemList li.item { border-bottom: 1px solid #c7c7c7; }
div.rssFeed ul.itemList li.item a.itemLink { text-decoration: none; display: block; padding-bottom: 6px;}
div.rssFeed ul.itemList li.item a.itemLink:hover {background-color: #f4f4f4; text-decoration: underline;}
div.rssFeed ul.itemList li.item p.description {
display: none;
}
div.footer {color: #fff;}
The rss.php file is referenced in a file called Home.php
<div class="rightCol">
<div class="content">
<p class="quote"><span><?= $page->getQuote() ?></span></p>
<h2>News</h2>
<?php include ($CONFIG['include_dir'].'rss-cio.php'); ?>
</div>
</div>
</div>
And rss.cio.php contains the following:
<?php
# URL to the RSS feed
// CIO.com
$FEED_URL = "http://feeds.cio.com/cio/feed/drilldown ... format=xml";
$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 } ?>
Any help in troubleshooting this would be appreciated.
The feed is on every page of the site. The Main CSS has is coded as
div.rssFeed {}
div.rssFeed h1 { display: none;}
div.rssFeed h2 { display: none;}
div.rssFeed ul.itemList {}
div.rssFeed ul.itemList li.item { border-bottom: 1px solid #c7c7c7; }
div.rssFeed ul.itemList li.item a.itemLink { text-decoration: none; display: block; padding-bottom: 6px;}
div.rssFeed ul.itemList li.item a.itemLink:hover {background-color: #f4f4f4; text-decoration: underline;}
div.rssFeed ul.itemList li.item p.description {
display: none;
}
div.footer {color: #fff;}
The rss.php file is referenced in a file called Home.php
<div class="rightCol">
<div class="content">
<p class="quote"><span><?= $page->getQuote() ?></span></p>
<h2>News</h2>
<?php include ($CONFIG['include_dir'].'rss-cio.php'); ?>
</div>
</div>
</div>
And rss.cio.php contains the following:
<?php
# URL to the RSS feed
// CIO.com
$FEED_URL = "http://feeds.cio.com/cio/feed/drilldown ... format=xml";
$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 } ?>
Any help in troubleshooting this would be appreciated.