я оптимизировал плагин:
надо добавить в свой css код это:
img.ico {
vertical-align: middle;
height: 24px;
border: none;
}
и сам плагин:
<?php
$plugin_info = array(
'pi_name' => 'weather',
'pi_version' => '1.0',
'pi_author' => 'eeclub',
'pi_author_url' => 'http://www.eeclub.ru',
'pi_description' => 'weather',
'pi_usage' => weather::usage()
);
class weather {
var $return_data;
/** ----------------------------------------
/** Weather
/** ----------------------------------------*/
function weather()
{
global $TMPL,$PREFS;
$city = (!$TMPL->fetch_param('city')) ? '27612' : $TMPL->fetch_param('city');
$url= 'http://pda.weather.yandex.ru/index.xml?city_id='.$city;
$source = file_get_contents($url);
if (!$source) die();
if (preg_match('|</a></div></td>\s+</tr></table>\s+<div>(.*?)</div>\s+</td>\s+</tr></table>|is', $source, $match))
{
$match[1] = '<div>'.$match[1].'</div>';
$match[1] = str_replace('src="/i/','src="'.$PREFS->ini('site_url').'images/', $match[1]);
$match[1] = str_replace('<nobr>','', $match[1]);
$match[1] = str_replace('class="ico">','class="ico"/>', $match[1]);
$match[1] = str_replace('<br>','<br />', $match[1]);
$match[1] = str_replace('</nobr>','', $match[1]);
$this->return_data=$match[1];
}
}
/* END */
// ----------------------------------------
// Plugin Usage
// ----------------------------------------
// This function describes how the plugin is used.
// Make sure and use output buffering
function usage()
{
ob_start();
?>
{exp:weather}
or
{exp:weather city="citycode"}
<?php
$buffer = ob_get_contents();
ob_end_clean();
return $buffer;
}
/* END */
}
// END CLASS
?>