Bonjour,
ce qui me vient tout de suite a l'esprit c'est qu'il y aurait une option desactivee sur le serveur... mais je ne sais absolument pas quoi faire. Peut etre sagit-il tout simplement de mon code. J'espere que vous pourrez m'aider.
Tout d'abord voici un extrait du xml:
Puis mon code php:
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11 <navigation> <links> <link idPage="1" displayName="Page 1" linkLoc="/" /> <link idPage="2" displayName="Page 2" linkLoc="http://www.monsite.com/test/" type="section"> <subLink idPage="TitreA" displayName="Titre A" linkLoc="http://www.monsite.com/content/show/237"/> <subLink idPage="TitreB" displayName="Titre B" linkLoc="http://www.monsite.com/content/show/205"/> <subLink idPage="TitreC" displayName="Titre C" linkLoc="http://www.monsite.com/content/show/206"/> </link> </links> </navigation>
En gros, je cherche a afficher une arborescence de la page en cours. Sur le serveur $nb est toujours egal a 1 alors qu'en local, j'ai bien tous les subLink.
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26 $toDisplay = ""; $myxml = simplexml_load_file("monxml.xml"); $xpath = 'links/link'; $links = $myxml->xpath($xpath); foreach($links as $lks) { $toDisplay .= "<a href='".$lks["linkLoc"]."' target='_parent'><strong>".$lks["displayName"]."</strong></a>\n"; $slinks = $lks->subLink; $nb = sizeof($slinks); $toDisplay .= "<ul>\n"; for($i = 0; $i < $nb; $i++) $toDisplay .= "<li><a href='".$slinks[$i]["linkLoc"]."' target='_parent'>".$slinks[$i]["displayName"]."</a></li>\n"; $toDisplay .= "</ul>\n"; if($nb == 0) $toDisplay = ""; } echo $toDisplay;
Merci d'avance pour votre aide.
Partager