DarkTranquillity 0 Posted June 14, 2011 Report Share Posted June 14, 2011 Всем доброго времени суток!Хочу модернизировать модуль по отображению курса валют добавив туда Латвийский Лат.На примере Российского ЦБ подставляю Латвийский:<?php/** * @author Darang, Gray <justPHP@gmail.com> * @date 10-Oct-2010 * @copyright (c)2010 JExt.biz, justPHP.net */// no direct accessdefined ( '_JEXEC' ) or die ( 'Restricted access' );/** * Official exchange rates of the National bank of Russia */class currency_data_cbr extends currency_data { function __construct() { parent::__construct (); $this->url = "http://www.bank.lv/vk/xml.xml"; $this->bank_name = "Latvijas Banka"; $this->bank_url = "http://www.bank.lv/"; $this->currency_name = "Lat"; } 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->ID [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] ['ID'] = $dt->ID [0]->data (); // num code $rates ['currency'] [$code] ['scale'] = $dt->Units [0]->data (); // units // Get the rate & replace comma to dot for further number processing $rates ['currency'] [$code] ['rate'] = str_replace ( ',', '.', $dt->Rate [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 . $date; } else { $url = $this->url; } return $url; }}Но пишет, что невозможно получить данные...Помогите решить эту проблему... или обновите модуль, это было бы вообще классно.Латвийские параметры:XML: http://www.bank.lv/v...l?date=20010323CSV: http://www.bank.lv/excel/valkurlv.phpRSS: http://www.bank.lv/lat/rss/kursi.phpБуду очень признателен за помощь. Quote Link to post Share on other sites
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.