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
| $dom = new DomDocument();
$xml="messages.xml";
$dom->load($xml);
$dom->validateOnParse = true;
$id = 10;
$id2= $id-4;
for($id ; $id > $id2 ; $id-- )
{
# Recherche du noeud message par idMax
$message = $dom->getElementById($id);
# Parcours de la liste enfants
$textes = $message->childNodes;
foreach ( $textes as $texte) // Ligne 164 !!!
{
if( $texte->nodeName=="texte"){
$max=50;
$chaine=$texte->nodeValue;
if(strlen($chaine)>=$max){$chaine=substr($chaine,0,$max);
$espace=strrpos($chaine," ");
$chaine=substr($chaine,0,$espace)."..."; }
?>
<li>
<a href="message.php5?id=<?php echo $id?>">
<font style="color:white;font-weight:normal">
<?php echo utf8_decode($chaine);?>
</font></a>
</li>
<?php
}
}
} |
Partager