// récupération du secteur principal :
<BOUCLE_secteurprincipal(RUBRIQUES) {id_rubrique}>
$secteurprincipal = #ID_SECTEUR;
</BOUCLE_secteurprincipal>
// récupération de la hiérarchie courante
$hierarchie = array();
<BOUCLE_principale(RUBRIQUES){id_rubrique}>
<BOUCLE_hierarchie(HIERARCHIE){id_rubrique}>
$hierarchie[] = #ID_RUBRIQUE;
</BOUCLE_hierarchie>
$hierarchie[] = #ID_RUBRIQUE;
$actuelle = #ID_RUBRIQUE;
</BOUCLE_principale>
?>
<div class="menu">
<!-- biz deletes
<ol>
-->
<!-- Affichage des rubriques : niveau 1 -->
<BOUCLE_secteurs(RUBRIQUES) {id_parent=0} {doublons} {par titre}>
<?php $id = #ID_RUBRIQUE; ?>
<BOUCLE_nb_rubriques(RUBRIQUES){id_parent}>
<?php ${'nb'.$id} = #TOTAL_BOUCLE; ?>
</BOUCLE_nb_rubriques>
<div class="menu-titre"
<?php if (#ID_SECTEUR == $secteurprincipal) {
echo (#ID_RUBRIQUE == $actuelle ? 'id="courant"' :
(in_array(#ID_RUBRIQUE, $hierarchie) ?
'id="courant"' : '')); }
?> >
<?php if (#ID_SECTEUR == $secteurprincipal) { echo'<a
href="#URL_RUBRIQUE">#TITRE</a>'; } ?>
</div>
<!-- Afficher les articles de cette rubrique -->
<?php if(#ID_RUBRIQUE == $actuelle) {
<B_articles3>
echo '
<ul class="menu-liste">
<li class="menu-item">
';
<BOUCLE_articles3(ARTICLES){id_rubrique}>
echo '
- <a href="#URL_ARTICLE">#TITRE</a><br>
';
</BOUCLE_articles3>
echo '
</li>
</ul>
';
</B_articles3>
;} {}
?>
<!-- -------------- Niveau 2 ---------------- -->
<BOUCLE_rubriques(RUBRIQUES) {id_parent}{par titre}>
<?php $id = #ID_RUBRIQUE; ?>
<BOUCLE_nb_sous_rubriques(RUBRIQUES){id_parent}>
<?php ${'nb'.$id} = #TOTAL_BOUCLE; ?>
</BOUCLE_nb_sous_rubriques>
<div class="menu-titre"
<?php if (#ID_SECTEUR == $secteurprincipal) { echo (#ID_RUBRIQUE ==
$actuelle ? 'id="courant"' :
(in_array(#ID_RUBRIQUE, $hierarchie) ? 'id="courant"' :
' ')); }?> >
<?php if (#ID_SECTEUR == $secteurprincipal)
{ echo'- <a href="#URL_RUBRIQUE">[(#TITRE|supprimer_numero)]
</a>';}
?>
</div>
<!-- Afficher les articles de cette rubrique -->
<?php if(#ID_RUBRIQUE == $actuelle) {
<B_articles4>
echo '
<ul class="menu-liste">
<li class="menu-item">
';
<BOUCLE_articles4(ARTICLES){id_rubrique}>
echo '
- <a href="#URL_ARTICLE">#TITRE</a><br>
';
</BOUCLE_articles4>
echo '
</li>
</ul>
';
</B_articles4>
;} {}
?>
<!-- ---------------- Niveau suivants -------------- -->
<BOUCLE_sousrubrique(BOUCLE_rubriques)> <!-- Boucles récursives
permettant de faire le même traitement -->
<BOUCLE_soussousrubrique(BOUCLE_rubriques)>
</BOUCLE_soussousrubrique>
</BOUCLE_sousrubrique>
</BOUCLE_rubriques>
</BOUCLE_secteurs>
Comme tu peux le voir dans ce code personnellement j'affiche à partir des
rubriques de niveau 1 mais en affichant l'arborscence seulement
de la rubrique sélectionnée, disons que si j'ai mes rubriques principales ( I-
II-III) et dans chacune mes sous-rubriques (1-2-3) et
que je choisis la I.2 et bien j'aurais en affichage :
- I
- I.1 -I.2 avec la I.2 en gras et ouverte avec
affichage des articles dedans
Si jamais tu veux seulement afficher les rubriques à partir
du niveau 3 il faut que tu enlèves la boucle récursive que
tu vois à la fin et que tu refasses les mêmes boucles que j'ai
fais pour les deux premiers niveaux, et ensuite que tu
n'affiches pas les 2 premiers nveaux par exemple en mettant
juste ça en commentaire :
<div class="menu-titre"
<?php if (#ID_SECTEUR == $secteurprincipal) {
echo (#ID_RUBRIQUE == $actuelle ? 'id="courant"' :
(in_array(#ID_RUBRIQUE, $hierarchie) ?
'id="courant"' : '')); }
?> >
<?php if (#ID_SECTEUR == $secteurprincipal) { echo'<a
href="#URL_RUBRIQUE">#TITRE</a>'; } ?>
</div>
Il faut savoir que j'ai encore un problème, le menu affiche des
cases vides , c'est à dire qu'il execute le div "menu-titre" mais
gràce au if n'y met pas les rubriques que je ne veux pas