Home · Latest · Trends  /  PHP
3

SimplePie - Smarty example

rated 3 times [  3] [ 0]  / comments: 0 / hits: 104  / 3 months ago, fri, may 10, 2019, 12:17:22
//PHP File
require_once ('autoloader.php');
$feed = new SimplePie();
$feed->set_feed_url('http://feeds.feedburner.com/TechCrunch/');
$feed->init();
$feed->handle_content_type();
if ($feed->error()) {
 echo $feed->error();
}
foreach ($feed->get_items() as $item):
 $i['get_title'] = $item->get_title();
 $i['get_description'] = $item->get_description();
 $items[] = $i;
endforeach;
$smarty->assign('items', @$items);

//Template File
{foreach from=$items item=posts} 
<div>{$posts.get_title}</div>
<div>{$posts.get_description}</div>
{/foreach}
More From » PHP
 

Comments

There are no comments for this Snippet yet
Only authorized users can post. Please sign in first, or register a free account
 
Share
Snippets
3 months ago, sun, may 5, 2019
3 months ago, mon, may 13, 2019
2 weeks ago, thu, jul 11, 2019
Sponsor
Posted
cilipe

cilipe

Member since May 2, 2019
Total Code Snippets: 5
Total Comments: 0
Location: n/a
Following
User not following anyone yet.