function convert_string($testo)
{
$testo = str_replace("à", "à", $testo);
$testo = str_replace("E'", "È", $testo);
$testo = str_replace("è", "è", $testo);
$testo = str_replace("é", "é", $testo);
$testo = str_replace("ì", "ì", $testo);
$testo = str_replace("ò", "ò", $testo);
$testo = str_replace("ù", "ù", $testo);
$testo = str_replace("…", "...", $testo);
$testo = str_replace("’", "'", $testo);
return $testo;
}
$titles[0]=convert_string("code");
$titles[1]=convert_string("nome");
$titles[2]=convert_string("indirizzo");
$titles[3]=convert_string("comune");
$titles[4]=convert_string("provincia");
$titles[5]=convert_string("regione");
$titles[6]=convert_string("cap");
$titles[7]=convert_string("telefono");
$titles[8]=convert_string("lunedì");
$titles[9]=convert_string("martedì");
$titles[10]=convert_string("mercoledì");
$titles[11]=convert_string("giovedì");
$titles[12]=convert_string("venerdì");
$titles[13]=convert_string("sabato");
$titles[14]=convert_string("domenica");
$source_file="store.csv";
$file=file($source_file, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES);
foreach($file as $key => $v)
{
$stores[$key]=explode(";",$v);
$regione[$stores[$key][5]]=$stores[$key][5];
$provincia[$stores[$key][5]][$stores[$key][4]]=$stores[$key][4];
$comune[$stores[$key][5]][$stores[$key][4]][$stores[$key][3]]=$stores[$key][3];
$punti[$stores[$key][5]][$stores[$key][4]][$stores[$key][3]][$stores[$key][1]]=$stores[$key][1];
$info[$stores[$key][5]][$stores[$key][4]][$stores[$key][3]][$stores[$key][1]]="
".$stores[$key][1].""."
".$stores[$key][2]."
".$stores[$key][6]." - ".$stores[$key][4]."
"."
Telefono: ".$stores[$key][7]."
"."
Orari: "."
"."
Lun: ".$stores[$key][8]."
"."
Mar: ".$stores[$key][9]."
"."
Mer: ".$stores[$key][10]."
"."
Gio: ".$stores[$key][11]."
"."
Ven: ".$stores[$key][12]."
"."
Sab: ".$stores[$key][13]."
"."
Dom: ".$stores[$key][8];
}
asort($regione);
?>
Regione: |
|
foreach($regione as $key => $v) { ?>
Provincia |
|
foreach($provincia[$v] as $key2 => $v2) { ?>
Comune |
|
foreach($comune[$v][$v2] as $key3 => $v3) { ?>
Punto |
|
foreach($punti[$v][$v2][$v3] as $key4 => $v4) { ?>
=$info[$v][$v2][$v3][$v4]?> |
} ?>
} ?>
} ?>
} ?>