Tue, April 7, 2020, 18:51:57
 
Home · Latest · Trends  /  PHP
5

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 5 times [  5] [ 0]  / comments: 0 / hits: 648  / 12 months ago, fri, may 10, 2019, 12:17:22
More From » PHP
 

Comments

There are no comments for this Snippet yet
Username
 
Your Comment
 
Share
Sponsor
Sponsor
Snippets
1 year ago, sun, may 5, 2019
12 months ago, mon, may 13, 2019
10 months ago, thu, jul 11, 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.