voici ma fonction :
<?
function construit_menu_arborescent_cat(&$sortie_cat, &$selectionne_cat, $parent_cat=0, $indent_cat=-1)
{
global $wwwroot, $catid;
$indent_cat +=1;
if(is_array($catid)) $catid=0;
// Recherche de tous les noeuds ayant $parent comme noeud parent
$qid = mysql_query("SELECT id, parent_id, nb, nom_".$_SESSION['langue']." FROM peel_categories WHERE parent_id = $parent_cat AND etat = '1' ORDER BY position");
// Si la requete a abouti
if($qid){
// Pour toutes les entrées
while($cat = mysql_fetch_array($qid)){
// Boucle pour ajouter l'indentation (une image vide)
// Pour aller plus loin on peut gérer des lignes de suite
for($i=0;$i<$indent_cat;$i++){
$sortie_cat .= "<img src='$wwwroot/images/mnu_empty.gif' border=0>";
}
// Recherche d'enfant pour déterminer l'aspect de l'icone (feuille ou dossier)
$fils_cat = mysql_query("SELECT 'id', 'parent_id', nom_".$_SESSION['langue']." FROM peel_categories WHERE 'parent_id' = ".$cat['id']." AND etat = '1' ORDER BY position");
$div_cat = 'mysql_num_rows($fils_cat)';
$value = mysql_query("SELECT nom_".$_SESSION['langue']." FROM peel_categories WHERE 'parent_id' = ".$cat['id']."");
// Si il y a des enfants
if ($div_cat) {
// Ajout de l'icone du dossier
$sortie_cat .= "<img src='$wwwroot/images/menplus.gif' border=0> ";
// Ajout du lien (identique à construit menu)
$sortie_cat .= "<a class=menuleft href=$wwwroot/achat/index.php?catid=" . $cat['id'] .">";
$action = "$wwwroot/achat/index.php?catid=" . $cat['id'] ."";
// Test si le noeud est le noeud actif (id), si oui, ajoute du gras (plus visuel)
if($cat['id']=='$catid') $sortie_cat .= "<b>";
// Ajoute le nom de la catégorie et débute un calque DIV ayant pour ID l'Id de la catégorie
$sortie_cat .= html_entity_decode($cat['nom_'.$_SESSION['langue'].'']);
$nb = calcul_nbprod_parcat($cat['id']);
if (!empty($nb)) {$sortie_cat .= " (".$nb.") "; }
$sortie_cat .= "</a></b><br /><DIV id=".$cat['id'];
// Recherche si le noeud fait partie de l'arborescence du noeud actif
parent_noeud_cat($cat['id'],'$catid', $actif_cat=0);
// Si Oui,
if(($cat['id'] == $catid) || ($actif_cat == 1)){
// Rends le calque visible
$sortie_cat.= " style=\"display:yes\">\n";
}
else{
// Sinon, rends le calque invisible
$sortie_cat.= " style=\"display:none\">\n";
}
}
// Sinon, c'est un document
else{
// Ajoute l'image du document
$sortie_cat .= "<img src='$wwwroot/images/menminus.gif' border=0> ";
// Ajoute le lien (identique à construit_menu)
$sortie_cat .= "<a class=menuleft href=$wwwroot/achat/index.php?catid=" . $cat['id'] .">";
// Si c'est la feuille active, la met en gras
if($cat['id']==$catid) $sortie_cat .= "<b>";
// Ajoute le nom
$sortie_cat .= html_entity_decode($cat['nom_'.$_SESSION['langue'].'']);
$value = $cat['nom_'.$_SESSION['langue'].''];
$nb = calcul_nbprod_parcat($cat['id']);
if (!empty($nb)) {$sortie_cat .= " (".$nb.") "; }
$sortie_cat .= "</a></b><br />";
}
// Si c'est un noeud (catégorie)
if($div_cat){
// Appel récursif pour ajout des enfants
construit_menu_arborescent_cat($sortie_cat, $selectionne_cat, $cat['id'], $indent_cat);
?>
<TABLE BORDER=0 CELLPADDING=0 CELLSPACING=0 ALIGN="CENTER">
<TR><TD>
<FORM ACTION="<? $action ?> ">
<INPUT TYPE="SUBMIT" VALUE="<? $value ?>"></TD>
</FORM></TR>
</TABLE>
<?
echo $value;
echo $action;
//Ferme le calque
$sortie_cat.="</div>";
}
}
}
}
comme vous pouvez le voir dans les dernières ligne j'ai inséré le bouton, mais lees variables "$action" et "$value" ne sont pas prises en compte et "$value" ne recoit pas la bonne valeur :$action -> http://www.basebio.jcrinformatique.fr/a ... p?catid=62 (ca c'est bon mais le lien ne fonctionne pas pour le bouton)
et
$value -> Resource id #22 (je ne vois pas a quoi ca correspond, il doit manquer une commande pour recupérer le nom de la catégorie correspondante)