Do you know any reason why the following code does work

$xmlOperazioni = simplexml_load_file($xmlFilename);
foreach($xmlOperazioni->operazione as $operazione) {
   if($operazione['nome'] == $operazioneRichiesta) {
      require($operazione['php']);
      break;
   }
}

but the following does not

$xmlOperazioni = 
simplexml_load_file($impostazioni['root']['configurazione']['generale']['xml_operazioni']);
foreach($xmlOperazioni->operazione as $operazione) {
   if($operazione->nome == $operazioneRichiesta) {
      require($operazione->php);
      break;
   }
}

that is I MUST access childrens of the element <operazione> as if it was an 
array, while (in the same page) the following code does work

$xmlViste = 
simplexml_load_file($impostazioni['root']['configurazione']['generale']['xml_composizione_viste']);
foreach($xmlViste->vista as $vista) {
    if($vista->nome == $nomeVistaDaMostrare) {
       $smarty->assign("intestazione","componenti/".$vista->intestazione);
       $smarty->assign("menu","componenti/".$vista->menu);
       $smarty->assign("contenuto", "componenti/".$vista->contenuto);
       $smarty->assign("pie_di_pagina", "componenti/".$vista->pie_di_pagina);
       break;
    }
}

but the following does not

$xmlViste = 
simplexml_load_file($impostazioni['root']['configurazione']['generale']['xml_composizione_viste']);
foreach($xmlViste->vista as $vista) {
    if($vista['nome'] == $nomeVistaDaMostrare) {
       $smarty->assign("intestazione","componenti/".$vista['intestazione']);
       $smarty->assign("menu","componenti/".$vista['menu']);
       $smarty->assign("contenuto", "componenti/".$vista['contenuto']);
       $smarty->assign("pie_di_pagina", "componenti/".$vista['pie_di_pagina']);
       break;
    }
}

that is this time I MUST access the childrens of the element <operazione> as if 
it was an object?

Reply via email to