Visualisation du fichier func_fiche_iti.php
<?php
// On récupère les variales passées.
//----------------------------------
$query_string = getenv("QUERY_STRING");
$query_string = substr($query_string,strpos($query_string, '-')+1,strlen($query_string));
$env_array = split("-", $query_string);
while (list($key, $val) = each($env_array)) {
list($name, $value) = split("=", $val);
$name = urldecode($name);
$value = urldecode($value);
$$name = trim($value) ;
}
global $distance;
function startEtape ($parser, $name, $attrs){
switch ($name) {
case "ETAPE":
echo "\n<tr>";
echo "\n\t<td width=\"11\" height=\"15\"><img width=\"10\" height=\"16\" src=\"./img/bg.jpg\"/></td>";
echo "\n\t<td width=\"80%\"><a href=\"".array_shift($attrs)."\">";
$GLOBALS["distance"] = array_shift($attrs);
}
}
function endEtape ($parser, $name){
switch ($name) {
case "ETAPE":
echo "</a></td>";
echo "\n\t<td>".$GLOBALS["distance"]."</td>";
echo "\n\t<td align=\"right\" width=\"1\" height=\"15\"><img width=\"1\" height=\"16\" src=\"./img/db.gif\"/></td>";
echo "\n</tr>";
}
}
function cdataEtape ($parser, $data_text){
echo $data_text;
}
function defautEtape (){return true;}
?>
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr>
<td colspan="4">
<table border="0" cellspacing="0" cellpadding="0" width="100%">
<tr>
<td width="11" height="15"><img width="11" height="15" src="./img/haut_gauche.jpg"/></td>
<td width="80%" class="btiny">Etapes</td>
<td class="btiny">Km</td>
<td align="left"><img width="7" height="15" src="./img/dh_gros.gif"/></td>
</tr>
</table>
</td>
</tr>
<?
$xmlFile = file($trajet);
$xml_parseur = xml_parser_create();
xml_set_element_handler($xml_parseur, "startEtape", "endEtape");
xml_set_character_data_handler($xml_parseur, "cdataEtape");
foreach($xmlFile as $elem)
{xml_parse($xml_parseur, $elem);}
?>
<tr>
<td colspan="4" valign="bottom"><img src="./img/bas.jpg" width="100%" height="4" alt=""/></td>
</tr>