[S] Magpie/RSS UDT worked 1.11.3 but kills Templates 1.11.4
Posted: Thu Feb 28, 2013 6:56 pm
I have a couple UDT's that are similar and use Magpie to parse an RSS feed. They will not run in the code tester in the UDT area but work just fine as stand-alone php and as a UDT when displayed in the front end. After upgrading to 1.11.4 though I cannot change a Template that calls them (or that calls a GCB in which they are called). I also cannot edit any pages that call the Template that calls them. Besides those issues the actual UDT still functions.
Here is the UDT {current_temp}:
Here is the UDT {current_temp}:
Code: Select all
require_once 'location/magpierss-0.72/rss_fetch.inc';
$url = 'http://www.weather.gov/xml/current_obs/KPSP.rss';
# Magpie throws USER_WARNINGS only
# so you can cloak these, by only showing ERRORs
error_reporting(E_ERROR);
# check the return value of fetch_rss()
$rss = fetch_rss($url);
if ( $rss ) {
$num_items = 1;
$items = array_slice($rss->items, 0, $num_items);
/*echo "Site: ", $rss->channel['title'], "<br>
\n";*/
foreach ( $items as $item ) {
$title = $item[title];
$url = $item[link];
$summary = $item[summary];
$newsummary = str_replace (" at Palm Springs Rgnl, CA", "", "$title");
$newsummary2 = preg_replace('[\D]', '', $newsummary);
echo strip_tags ("Weather: " . $newsummary2 . " °F");
}
}
else {
echo "Error" .
"<br>
Error Message: " . magpie_error();
}