dozent Опубликовано 18 июня, 2011 Жалоба Поделиться Опубликовано 18 июня, 2011 Доброго времени суток,Решил добавить в модуль JextCurrency курсы Национального банка Таджикистана (НБТ), изменил код см.ниже:НБТ: http://nbt.tj/ru/kurs/?c=4&id=28&lg=ru&d=17-06-2011&export=xmloutДалее добавил в mod_jextcurrency.xml след. строку: <option value="nbt">PLG_JEXTCURRENCY_SOURCE_OPTION_NBT</option>Результат: Пишет невозможно получить данные.Что не так сделано? Цитата Ссылка на комментарий Поделиться на другие сайты More sharing options...
admin Опубликовано 18 июня, 2011 Жалоба Поделиться Опубликовано 18 июня, 2011 <?php/*** @author Darang* @date 24-June-2011* @copyright (c)2010-2011 JExt.biz*/// no direct accessdefined ( '_JEXEC' ) or die ( 'Restricted access' );/*** Official exchange rates of the National bank of Tajikistan*/class currency_data_nbt extends currency_data { function __construct() { parent::__construct (); $this->url = "http://nbt.tj/ru/kurs/?c=4&id=28&lg=ru&export=xmlout"; $this->bank_name = "National bank of Tajikistan"; $this->bank_url = "http://www.nbt.tj"; $this->currency_name = "таджикского сомони"; $this->date_format = 'd-m-Y'; } function get_array($xml, $day = '', $replace_currency_array) { // Handle no data received error if (! isset ( $xml->document->Valute )) { $error ['error'] = 1; return $error; } // Save currencies' rates in an associative array indexed by currency 3 char code $rates = array (); // array to store currencies exchange rates $rates ['date'] = $xml->document->attributes ( 'date' ); $data = $xml->document->Valute; foreach ( $data as $dt ) { $code = $dt->CharCode [0]->data (); // Store data for selected by user currencies only, if they are set if (empty ( $this->currencies ) || in_array ( $code, $this->currencies )) { //$rates ['currency'] [$code] ['numcode'] = $dt->NumCode [0]->data (); // num code $rates ['currency'] [$code] ['scale'] = $dt->Nominal [0]->data (); // units // Set currency name (array with replacement rules will be searched for the ISO code) $rates ['currency'] [$code] ['name'] = parent::replace_currency_name ( $dt->Name [0]->data (), $code, $replace_currency_array ); // Get the rate & replace comma to dot for further number processing $rates ['currency'] [$code] ['rate'] = str_replace ( ',', '.', $dt->Value [0]->data () ); } } // Save additional info (only one time) if ($day == 'today' || $this->before_flag == FALSE) { $rates ['info'] = array ("bank_name" => $this->bank_name, "bank_url" => $this->bank_url, "currency_name" => $this->currency_name ); } return $rates; } /** * Returns URL for receiving XML data file * * @param string Date * @return string URL */ public function getUrl($date = "") { if (strlen ( $date ) > 1) { $url = $this->url.'&d='.$date; } else { $url = $this->url; } return $url; }} Цитата Ссылка на комментарий Поделиться на другие сайты More sharing options...
Рекомендуемые сообщения
Присоединяйтесь к обсуждению
Вы можете написать сейчас и зарегистрироваться позже. Если у вас есть аккаунт, авторизуйтесь, чтобы опубликовать от имени своего аккаунта.
Примечание: Ваш пост будет проверен модератором, прежде чем станет видимым.