Fri, October 30, 2020, 13:00:40
 
Home · Latest · Trends  /  PHP
6

SimplePie - Smarty example

//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}
rated 6 times [  6] [ 0]  / comments: 0 / hits: 1078  / 2 years ago, fri, may 10, 2019, 12:17:22
More From » PHP
 

Comments

There are no comments for this Snippet yet
Username
 
Your Comment
 
Share
Snippets
2 years ago, sun, may 5, 2019
2 years ago, mon, may 13, 2019
Posted
cilipe

cilipe

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