PDA

View Full Version : how to include my php into module


kafi
10-09-2004, 01:34 PM
Hello,

I would like to include php code into module, but I only know html code.
I will really appreciate if you show me a hints how to do it and how to transfer this code into template (so I can dress information in it).

Here is the code:
many thanks in advance
<?
/******************************************************************/
/******************************************************************/
// PARAMETRE //
/******************************************************************/
/******************************************************************/
$KFile = "http://www.nbs.sk/KL/AKTKLSL.XML";
$arr_allowed = array(
'Japonsko',
'Austrália',
'Česká republika',
'Dánsko',
'EMÚ',
'Kanada',
'Maďarsko',
'Nórsko',
'Poľsko',
'Slovinsko',
'Švajčiarsko',
'Švédsko',
'USA',
'V. Británia',
'MMF-ZPČ-SDR'
);
/******************************************************************/
/******************************************************************/
// Vypis //
/******************************************************************/
/******************************************************************/
$klistok = GetKurzovyListok($KFile, $arr_allowed);

if($klistok) {
foreach($klistok as $kurz) {
echo("$$ ".$kurz[0]." # ".$kurz[1]." # ".$kurz[2]." # ".$kurz[3]." <BR>");
}
}















/******************************************************************/
/******************************************************************/
// FUNKCIE //
/******************************************************************/
/******************************************************************/




function GetKurzovyListok($Kfile, $arr_allowed) {
if(!$file=fopen("http://www.nbs.sk/KL/AKTKLSL.XML", "r")) {
return(0);
}

$item=0;
while (!feof($file)) {
$all_strings .= fgets($file, 1024);;
}

$kk = 0;
while(($pos_country_s = strpos($all_strings, "<country>")) > 0) {
$pos_country_e = strpos($all_strings, "</country>" );
$pos_code_s = strpos($all_strings, "<ccyCode>" );
$pos_code_e = strpos($all_strings, "</ccyCode>" );
$pos_amount_s = strpos($all_strings, "<amount>" );
$pos_amount_e = strpos($all_strings, "</amount>" );
$pos_value_s = strpos($all_strings, "<value>" );
$pos_value_e = strpos($all_strings, "</value>" );

$name = substr($all_strings, ($pos_country_s+9), ($pos_country_e-$pos_country_s-9));
if(!(in_array($name, $arr_allowed))) {
$all_strings = substr($all_strings, ($pos_value_e+5));
continue;
}
$klistok[$kk][0] = $name;
$klistok[$kk][1] = substr($all_strings, ($pos_code_s+9), ($pos_code_e-$pos_code_s-9));
$klistok[$kk][2] = substr($all_strings, ($pos_amount_s+8), ($pos_amount_e-$pos_amount_s-8));
$klistok[$kk][3] = substr($all_strings, ($pos_value_s+8), ($pos_value_e-$pos_value_s-8));

$kk++;
$all_strings = substr($all_strings, ($pos_value_e+5));
}
return($klistok);
}
?>

Brian
10-09-2004, 05:03 PM
http://www.vbadvanced.com/forum/showthread.php?t=1082&highlight=php+module