Announcements
Browse announcements.
WEB SOLUTIONS
FOR A GROWING BUSINESS
For all of your online business needs.
Article ID: 75 Created on: 04/23/2009 12:24 pm Modified on: 04/23/2009 12:24 pm
This is easily accomplished by adding the following snipplet to any page that you wish to display feed content from:
<?php // Load the XML file into a Simple XML object
$filename = "URL_OF_FEED_HERE";
$feed = simplexml_load_file($filename);
foreach ($feed->channel->item as $item) {
$chars = 150;
if(strlen($item->description) > $chars)
{
$item->description = $item->description." ";
$item->description = substr($item->description,0,$chars);
$item->description = substr($item->description,0,strrpos($item->description,' '));
$item->description = $item->description."...";
}
echo "<p><a href='" . $item->link . "' class='leftlink'>" . $item->title . "</a></p>";
echo "<p>" . $item->description . "</p>";
}
?>
This is an example and works very well for any type of site!
How Helpfull was this article to you?
Rating: 0 / 5 (0 votes cast)There are no comments