Tue, January 26, 2021
 
https://devcodepro.comdevcodepro
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: 1210  / 2 years ago, fri, may 10, 19, 12:17:22
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
Posted
cilipe
Member since May 2, 2019
Total Code Snippets: 5
Total Comments: 0
Location: n/a
cilipe snippets
2 years ago, thu, may 2, 19, 4:15:11
comments: 0 / hits: 6701
2 years ago, sun, may 5, 19, 1:44:43
comments: 0 / hits: 888
C#
2 years ago, mon, may 13, 19, 5:24:07
comments: 0 / hits: 909
2 years ago, thu, jul 11, 19, 5:30:34
comments: 0 / hits: 1650
CSS