Smarty Forum Index Smarty
The discussions here are for Smarty, a template engine for the PHP programming language.
Reading RSS Feed with Smarty 3.17

 
Post new topic   Reply to topic    Smarty Forum Index -> Tips and Tricks
View previous topic :: View next topic  
Author Message
jacz
Smarty Pro


Joined: 13 Nov 2010
Posts: 249

PostPosted: Fri Jan 13, 2012 1:35 pm    Post subject: Reading RSS Feed with Smarty 3.17 Reply with quote

Here the code to read and display the BBC News Feed with Smarty 3.1.7:

Code:

{$rss=simplexml_load_file('http://feeds.bbci.co.uk/news/rss.xml?edition=uk')}
<h2>{$rss->channel->title}</h2>
<h4>{$rss->channel->description}</h4>
<p>{$rss->channel->lastBuildDate}<br />{$rss->channel->copyright}<br/><a href="{$rss->channel->image->link}"><img src="{$rss->channel->image->url}" width="{$rss->channel->image->width}" height="{$rss->channel->image->height}" title="{$rss->channel->image->title}" /></a></p>
{foreach $rss->channel->item as $a}
 <p><a href="{$a->link}">{$a->title}</a> vom {$a->pubDate}</p>
 <p>{$a->description}</p>   
 {/foreach}   


Sample is showing here:

http://powercms.org/?366
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    Smarty Forum Index -> Tips and Tricks All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group
Protected by Anti-Spam ACP