Passer variables XML sur une autre page
Bonjour
ayant un peu avancé je vais reformuler ma problématique. Je souhaite faire passer des valeurs ayant le meme nom de balise XML d'un fichier php vers un autre.
l'extrait du fichier xml :
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14
| <model>MODENA 450</model>
<photo_list>
<photo>
1-185.JPG
</photo>
</photo_list>
<model>EDALON 556</model>
<photo_list>
<photo>
1-185.JPG
</photo>
<photo>
2-185.JPG
</photo> |
sur un premiere page j'ai le lien qui pointe vers la 2e page, censée passer en variable les multiple champs <photo> et <model>:
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14
|
$xml = utf8_encode(file_get_contents('176.xml'));
$rows = array();
$sxml = simplexml_load_string($xml);
foreach($sxml as $node) {
$model = htmlspecialchars((string)$node->model, ENT_QUOTES);
$photo = (string)$node->photo_list->photo;
$rows[] = <<<HTML
<a href="http://MONSITE.fr/fancy/demo/test8.php?model={$model}&photo={$photo}">lien vers produit</a></br>
{$model}
HTML;
} |
et sur la seconde page je souhaite afficher ces photos :
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14
| $model = $_GET['model'];
$photo = $_GET['photo'];
echo $model;
$i = 0;
foreach ($photo_list as $photo) {
$photo = strval($photo);
$photo = trim($photo);
if ($i == 0)
echo '<img src="'.$photo.'" alt="" />';
echo '</a>';
$i ++;
} |
cela m'affiche seulement la première photo. Comment pourrais je faire pour passer en URL les différentes valeurs des champs <photo> ?
Si quelqu'un pourrait m'éclairer....