Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at magento.stackexchange.com, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email community@magento.com.

Magento Forum

Has anyone used any rss to html php scripts to display rss feeds within your store
 
platinumtackle
Member
 
Total Posts:  40
Joined:  2008-09-30
 

I found http://www.feedforall.com/free-php-script.htm and it looks pretty good, but have no idea how to add it to magento so i can make calls to it within my theme.  Any help would be greatly appreciated.

 
Magento Community Magento Community
Magento Community
Magento Community
 
Ben Marks
Moderator
 
Avatar
Total Posts:  452
Joined:  2008-10-09
Charleston, SC
 

The following may work for you.  It can be done more elegantly, but this is the meat and potatoes of what you want. 

<div id="rss_summary">
    
    <
h4><span>Latest News</span></h4>

    <
ul>
    
<?php
        
        $feedUrl 
'http://site.com';
        
$rawFeed file_get_contents($feedUrl);
        
$xml = new SimpleXmlElement($rawFeed);
        foreach (
$xml->channel->item as $item{
            
echo '<li><a href="'.$item->link.'" title="'.$item->description.'">'.$item->title.'</a></li>';
        
}
        
        $link 
$xml->channel->link;

    
?>
    
</ul>
    
    <
div class="feed_link">
        <
a href="<?php echo $xml->channel->link ?>">Subscribe to this Feed</a>
    </
div>
    
</
div>
 
Magento Community Magento Community
Magento Community
Magento Community
 
vibe9
Jr. Member
 
Total Posts:  4
Joined:  2008-07-29
 

@blueben - your solution works perfectly. Thanks!

 
Magento Community Magento Community
Magento Community
Magento Community
 
platinumtackle
Member
 
Total Posts:  40
Joined:  2008-09-30
 

blueben,

The code you have written works, but I want to actually display a little of the description on my page.  The problem I am seing is that all apostrophes and double quotes display as little boxes.  What can I do to fix this?

<div id="rss_summary">
    
    <
h3><span>Latest Fishing Report from <?php echo $namehtml ?></span></h3>

    <
ul>
    
<?php
        
        $rawFeed 
file_get_contents($_guide_rss_url);
        
$xml = new SimpleXmlElement($rawFeed);
        foreach (
$xml->channel->item as $item{
            
echo '<li><a href="'.$item->link.'" target="_blank" title="'.$item->title.'">'.$item->title.'</a><p class="category-description">'.$item->description.'</p></li>';
        
}
        
        $link 
$xml->channel->link;

    
?>
    
</ul>
    
    <
div class="feed_link">
        <
a href="<?php echo $xml->channel->link ?>">Subscribe to this Feed</a>
    </
div>
    
</
div>
Image Attachments
Picture 6.png
 
Magento Community Magento Community
Magento Community
Magento Community
 
subesh
Sr. Member
 
Avatar
Total Posts:  145
Joined:  2009-01-08
 

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1” />

or

<meta http-equiv="Content-Type" content="text/html; charset=unicode-UTF” /> (Some thing like this.. google it)

 
Magento Community Magento Community
Magento Community
Magento Community
 
platinumtackle
Member
 
Total Posts:  40
Joined:  2008-09-30
 

Already have UTF-8 and tried the other one, but did not make a difference.

 
Magento Community Magento Community
Magento Community
Magento Community
 
platinumtackle
Member
 
Total Posts:  40
Joined:  2008-09-30
 

For those of you trying to do this.  Please research these links as they provide a better way to parse and use feeds.

Zend Feed documentation

 
Magento Community Magento Community
Magento Community
Magento Community
 
Ben Marks
Moderator
 
Avatar
Total Posts:  452
Joined:  2008-10-09
Charleston, SC
 

I concur; my code above was a 5 minute solution for a deadline.  Use the power of ZF whenever possible!

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top