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 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136
| <?php
$document_xml = new DomDocument();
DomDocument : création d'un nouvel objet
$resultat_html = '';
$document_xml->load('................'); // Chargement à partir de .......xml
$elements = $document_xml->getElementsByTagName('.........');
$element = $elements->item(0); // On obtient le nœud .........
$enfants = $element->childNodes; // On récupère les nœuds enfants de .......
avec childNodes
$plophtml.='
page html
....
....
....
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr valign="top">
<td>
<table cellpadding="5" cellspacing="1" id="result_rech">
<tr>
<th scope=col width=452>prem</th>
<th scope=col width=150>sec</th>
<th scope=col width=150>trois</th>
</tr>'.$plophtml.='</td>
</table>
</tr>
</table>
<DIV ID=\'BOU\' STYLE=\'position:absolute;width:144px;height:150px;z-index:1;top:0;visibility:hidden;\'><IMG src=\"chemin/_img........gif\" border=0></a></DIV>
</body>
</html>';
$plophtml = utf8_decode($plophtml);
echo $plophtml;
/* $elements_1 = $document_xml->getElementsByTagName('.......');
$element2 = $elements_1->item(0); // On obtient le nœud ........
$enfants = $element2->childNodes; // On récupère les nœuds enfants de ........... avec childNodes */
//deuxième boucle
// création du nouvel objet document
$dom = new DomDocument();
// chargement à partir du fichier
$dom->load("...............xml");
$............ = $document_xml->getElementsByTagName('...........');
//$.......... = $..........->item(0);
//$cat = $...........->childNodes;
foreach($........... as $.............)
{
$.................... = $............->childNodes;
foreach($.............. as $cat)
{
//echo $cat->nodeName.'<br>';
$nom = $cat->nodeName;
if ($nom == 'Nom_app')
{
echo '<table width="100%" border="0"
cellpadding="0" cellspacing="0">
<tr valign="top"><table cellpadding="5" cellspacing="1" id="result_rech">
tr>'.$cat->nodeValue.'<br>'; //variable principale que je voudrais mettre entre tableau.
}
if ($nom == '..............')
{
foreach($cat->childNodes as $...........)
{
//echo $............->nodeName.'<br>';
if($............->nodeName == '........')
{
echo ' <br>';
foreach($............->childNodes as $hello)
{
$nom1 $hello->nodeName;
if ($nom1 == '.....')
{
echo ' ....res1.... '.$hello->nodeValue;
}
if ($nom1 == '....')
{
echo ' .res2. : '.$hello->nodeValue;
}
if ($nom1 == '......')
{
echo '..res3.. : '.$hello->nodeValue;
}
if ($nom1 == '.....')
{
echo '...res4. : '.$hello->nodeValue;
}
}
}
}
}
}
}
?>
<?php
$plop1html = ''; // Initialisation de la chaîne qui contient le résultat
$plop1html.='<tr>
<td align="right"> </td>
</tr>
</table>
</td>
</tr>
<tr valign="top" id="footer">
<td id="footer_l">
....date.....
</td>
<td>
<div id="footer_r"><a href="javascript:buttonOffline();">.........</a> | <a href="javascript:buttonOffline();">À
propos de</a></div>
</td>
</tr>
</table>
<DIV ID=\'BOU\' STYLE=\'position:absolute;width:144px;height:150px;z-index:1;top:0;visibility:hidden;\'><IMG src="...../_img/.........gif" border=0></a></DIV>';
$plop1html = utf8_decode($plop1html);
echo $plop1html;
?> |
Partager