Hi!
I am trying to get an external RSS feed call from one snippet into another.
I found something about it, but it was 7 years old...for evo - so maybe it's now more easy?
I tried it with "real" php files - and it works.
In modx revo I created a snippet like this:
require_once('getRss.php');
echo fetchFeed('http://www.amazon.de/rss/...');
It gets the "getRss.php" - but is it possible to easily include it from the snippets?
the contents are:
<?php
function fetchFeed($feed_url){
$output = '';
$content = file_get_contents($feed_url);
$feeditems = new SimpleXMLElement($content);
foreach($feeditems->channel->item as $entry){
$output .= "<a style='$color' href='$entry->link' title='$entry->title'>" . $entry->title . '</a><br />';
}
return $output;
}
I tried to make it static..but it is not the same...
Thank you!
AD