Page 1 of 1

[S] Magpie/RSS UDT worked 1.11.3 but kills Templates 1.11.4

Posted: Thu Feb 28, 2013 6:56 pm
by jaslorax
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}:

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 . " &#176;F");
        }
        }
        else {
        echo "Error" .
        "<br>
        Error Message: " . magpie_error();
        }

Re: Magpie RSS UDT worked in 1.11.3 but kills Templates 1.11

Posted: Thu Feb 28, 2013 7:27 pm
by jaslorax
Issue seems to be here:

Code: Select all

require_once 'location/magpierss-0.72/rss_fetch.inc';
Just added "../" before required magpie location - noticed some css needed this with the upgrade from {stylesheet} to {cms_stylesheet} . . . because it now comes from /tmp/cache.

This made it run in the back end tester and fixed all the Template not submitting errors and let Pages that called the template be editable again.

This makes sense as the back-end call is from "/admin". This, however, broke it on the front-end display. Not sure why calling it with the domain breaks it on the front and back as well . . .

[SOLVED] Required full server path . . .