private function getParent( $num_animal_categorie=0, $chemin='' ) { $temp = ""; $categorie = new animal_categorie(); if ( $categorie->load( $num_animal_categorie ) ) { //echo "#" . $num_animal_categorie . " : " . $categorie->nom . " (ID Parent : " . $categorie->num_parent . ")<br>"; $chemin = ( $chemin != '' ) ? $num_animal_categorie . ";" . $categorie->nom . "-" . $chemin : $num_animal_categorie . ";" . $categorie->nom; if ( $categorie->num_parent > 0 ) { //echo "-->" . $chemin . "<br>"; $temp = $this->getParent( $categorie->num_parent, $chemin ); } else { $temp = $chemin; //echo "---->" . $temp . "<br>"; } } return ( $temp ); }
// On liste tous les sites foreach( $liste_animal as $_animal ) { $index = $index + 1; if ($index % 2) { $choix_couleur = "#F5FFE5"; $fonce = "_fonce"; } else { $choix_couleur = "#E4FDC3"; $fonce = ""; } // Récupération du nom de la catégorie $nom_categorie = ( $categorie_temp->load( $_animal->num_animal_categorie ) ) ? stripcslashes( utf8_encode( $categorie_temp->nom ) ) : "-"; ?> <tr> <td> <table cellpadding=0 cellspacing=0 style="width:100%;background-color:<?php echo $choix_couleur; ?> ;" border="0"> <tr> <td> <table cellpadding=0 cellspacing=0 style="width:100%;" border="0"> <tr> <td width="*" height="20"> <a href="javascript:afficher(<?php echo $_animal->num_animal; ?>