Takže už som to spravil pomocou rss_parser. Vysledok si môžete pozrieť tu [
http://www.diviaky.sk]. Ešte by som však potreboval vyriešit aby tam zobrazovalo len určité, mnou vybraté štaty. Tu je upraveny súbor rss_parser.php
<?
######################################################################
# phpRS Plug-in modul: RSS správy 2.0.0 Rssconfig
######################################################################
// Copyright (c) 2003 by MSteve - Makker Štefan ([email]mstevel@zoznam.sk[/email])
// [http://www.webinfo.sk]
// This program is free software. - Toto je bezplatny a svobodny software.
// funkcia rss_show() zobrazi linky z jedneho rss suboru
// plug-in z [http://www.develope.host.sk/index.php?action=download]
// upravil Mirek Svrcek - [email]mirek@svrcek.cz[/email]
$_item=array();
$_depth=array();
$_tags=array('dummy');
function prekoduj_win2iso($nacteno) {
$koduj[128]="€";
$koduj[130]="‚";
$koduj[132]="„";
$koduj[133]="…";
$koduj[134]="†";
$koduj[135]="‡";
$koduj[137]="‰";
$koduj[139]="‹";
$koduj[145]="‘";
$koduj[146]="’";
$koduj[147]="“";
$koduj[148]="”";
$koduj[149]="•";
$koduj[150]="–";
$koduj[151]="—";
$koduj[153]="™";
$koduj[155]="›";
$co=chr(0).chr(1).chr(2).chr(3).chr(4).chr(5).chr(6).chr(7);
$co.=chr(8).chr(9).chr(10).chr(11).chr(12).chr(13).chr(14).chr(15);
$co.=chr(16).chr(17).chr(18).chr(19).chr(20).chr(21).chr(22).chr(23);
$co.=chr(24).chr(25).chr(26).chr(27).chr(28).chr(29).chr(30).chr(31);
$co.=chr(129).chr(131).chr(136).chr(144).chr(152);
$co.=chr(138).chr(140).chr(141).chr(142).chr(143).chr(154).chr(156).chr(157).chr(158).chr(159);
$kam=" ";
$kam.=chr(169).chr(166).chr(171).chr(174).chr(172).chr(185).chr(182).chr(187).chr(190).chr(188);
$nacteno=strtr($nacteno, $co, $kam);
foreach ($koduj as $key => $value) {
$nacteno=str_replace(chr($key), $value, $nacteno);
}
return $nacteno;
}
function initArray() {
global $_item;
$_item=array('COUNTRY'=>'', 'CCYCODE'=>'', 'AMOUNT'=>'', 'VALUE'=>'' );
}
// funkcia sa vola ak XML parser najde zaciatocny tag
function startElement($parser, $name, $attrs) {
global $_depth, $_tags, $_item;
if ( ($name == 'RATE')||($name == 'CHANNEL')||($name == 'IMAGE')) {
initArray();
}
if (isset($_depth[$parser])) {
$_depth[$parser]++;
}
else {
$_depth[$parser]=1;
}
array_push($_tags, $name);
}
// funkcia sa vola ak XML parser najde ukoncovaci tag
function endElement($parser, $name) {
global $_depth, $_tags, $_item, $rss_output, $rss_desc, $rss_img;
array_pop($_tags);
$_depth[$parser]--;
switch ($name) {
case 'RATE':
if($rss_desc == true) {
$rss_output.='<div class="country">' . $_item['COUNTRY'] . '</div><div class="amount">' . $_item['AMOUNT'] . '' . $_item['CCYCODE'] . ' = ' . $_item['VALUE'] . 'SK</div>' . "\r\n";
}
initArray();
break;
case 'IMAGE':
if($rss_img == true) {
$rss_output.='<a class="smal" href="' . $_item['LINK'] . '" target="_blank"><img src="' . $_item['URL'] . '" alt="' . $_item['TITLE'] . '" border="0"></a><br>' . "\r\n";
}
initArray();
break;
case 'CHANNEL':
//$rss_channel = $_item[TITLE];
initArray();
break;
}
}
// handler funkcia pre xml_set_character_data_handler()
function parseData($parser, $text) {
global $_depth, $_tags, $_item;
$crap=preg_replace("/\s/", "", $text);
if ($crap) {
$text=preg_replace("/^\s+/", "", $text);
if (isset($_item[$_tags[$_depth[$parser]]] )) {
$_item[$_tags[$_depth[$parser]]].=$text;
}
else {
$_item[$_tags[$_depth[$parser]]]=$text;
}
}
}
function parseRDF($xml_data) {
global $_depth, $_tags, $_item, $rss_output;
$rss_output='';
$xml_parser=xml_parser_create();
initArray();
// nastavenie handler funkcii pre zachytavane udalosti
xml_set_element_handler($xml_parser, "startElement", "endElement");
xml_set_character_data_handler($xml_parser, "parseData");
if (! xml_parse($xml_parser, $xml_data, true)) {
$rss_output='chyba v XML';
}
xml_parser_free($xml_parser);
return $rss_output;
}
?>
Celkem upraveno 1×. Poslední úprava convert v 19.09.2005 23:36.