par
sadeq » 15 sept. 2006, 12:04
Bon, tout d'abord et avant d'aller plus loin, il faut débuguer le code en affichant des éspions de variables.
tu dois afficher les variables suivantes :
$lastID = getLastNewsId();
echo "<p>last id: $lastID<p>";
if ($lastID<0){
echo "<div class='newsDiv'>no news actually</div>";
}
else{
echo "<p>Crt Lang: $crtLang<p>";
echo getNews($lastID,$crtLang);
}
et dans tes fonctions :
function getLastNewsId(){
global $xpath_news;
echo "<p>Path_news: <br>"; print_r($xpath_news); echo "<p>";
$nb = getNbOfElement("/NewsRoot/news",$xpath_news);
return ($nb-1);
}
function getNbOfElement($xpathString, $xpath){
$nodeList = $xpath->query($xpathString);
return $nodeList->length;
}
Bon, tout d'abord et avant d'aller plus loin, il faut débuguer le code en affichant des éspions de variables.
tu dois afficher les variables suivantes :
[php]$lastID = getLastNewsId();
echo "<p>last id: $lastID<p>";
if ($lastID<0){
echo "<div class='newsDiv'>no news actually</div>";
}
else{
echo "<p>Crt Lang: $crtLang<p>";
echo getNews($lastID,$crtLang);
}[/php]
et dans tes fonctions :
[php]function getLastNewsId(){
global $xpath_news;
echo "<p>Path_news: <br>"; print_r($xpath_news); echo "<p>";
$nb = getNbOfElement("/NewsRoot/news",$xpath_news);
return ($nb-1);
}
function getNbOfElement($xpathString, $xpath){
$nodeList = $xpath->query($xpathString);
return $nodeList->length;
}[/php]