Platform used: Can install sourcerer plugin for Joomla (to read PHP from Custom HTML snippet)  to include <?php ?> code

Code:

{source}
<?php
// Create a new DOMDocument object
$doc = new DOMDocument();

// Load the RSS file into the object
$doc->load(‘http://feeds.feedburner.com/com/XXqly’);

// Initialize empty array
$arrFeeds = array();

// Get a list of all the elements with the name ‘item’
foreach ($doc->getElementsByTagName(‘item’) as $node) {
$itemRSS = array (
‘title’ => $node->getElementsByTagName(‘title’)->item(0)->nodeValue,

‘link’ => $node->getElementsByTagName(‘link’)->item(0)->nodeValue

);
array_push($arrFeeds, $itemRSS);
}

$t0= $arrFeeds[0][‘title’];
$l0 = $arrFeeds[0][‘link’];
$t1= $arrFeeds[1][‘title’];
$l1 = $arrFeeds[1][‘link’];
$t2= $arrFeeds[2][‘title’];
$l2 = $arrFeeds[2][‘link’];
$t3= $arrFeeds[3][‘title’];
$l3 = $arrFeeds[3][‘link’];
$t4= $arrFeeds[4][‘title’];
$l4 = $arrFeeds[4][‘link’];

?>
{/source}

<ul>
<li><a href=”{source}<?php echo $l0; ?>{/source}”>{source}<?php echo $t0; ?>{/source}</a></li>

</ul>

May 20, 2015

Read a Feed burner and lists the top five blogs

Platform used: Can install sourcerer plugin for Joomla (to read PHP from Custom HTML snippet)  to include <?php ?> code Code: {source} <?php // Create a new […]