guardando qua e lą ho tirato fuori questo script:
Codice PHP:
$path_xml_file = "swfcontent/images2.xml";
//CREA XML
/* creo il documento base */
if(file_exists($path_xml_file)){
unlink($path_xml_file) or die("Impossibile cancellare il file esistente!");
} else {
//creo il file vuoto
$f = fopen($path_xml_file, "w") or
die("Impossibile creare il file $path_xml_file");
fclose($f);
/*Scrivo nel file il root node*/
$doc = domxml_new_doc("1.0");
$root = $doc->add_root("images");
$root->set_attribute("timer","10");
$root->set_attribute("order","sequential");
$root->set_attribute("fadetime","2");
$root->set_attribute("looping","yes");
$root->set_attribute("xpos","0");
$root->set_attribute("ypos","0");
/*Aggiungo i child*/
for ($i=1;$i<=$tot;$i++) {
$child = $root->new_child("image","");
$child->set_attribute("id","$i");
$child->set_attribute("path","swfcontent/images/$i.jpg");
$child->set_attribute("desc","$descr[$i]");
}
/*Scrivo il file*/
$doc->dump_file($path_xml_file, false, false) or
die("Errore durante la scrittura del file xml: $path_xml_file");
$doc = null;
}
Bene, non funziona. Mi dą questo errore:
Warning: fopen(swfcontent/images2.xml) [function.fopen]: failed to open stream: No such file or directory in C:\Program Files\Apache Group\Apache2\htdocs\fondazione\test\cp\cp_flash.p hp on line 77
Impossibile creare il file swfcontent/images2.xml
Perchč?
Ora comunque provo anche a guardare quell'esempio che mi hai suggerito...