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 34 35 36
| <?PHP
//INSTANCE DE REQUETE
$sql = new Sqlal();
IF(EMPTY($_GET['som'])AND!EMPTY($_GET['rub'])){
$g_id_rub=$_GET['rub'];
$sql->query("SELECT id_rubrique,id_parent,titre FROM rubriques WHERE id_rubrique='".$g_id_rub."';","rub");
$row_sec=$sql->fetch_object("rub");
$id_parent=$row_sec->id_parent;
$id_rub_voulu=$row_sec->id_rubrique;
$nom_rub_voulu=$row_sec->titre;
//REDIRECTION SI RUB A UN PARENT===0 CE QUI NE DEVRAIT PAS ARRIVÉ
IF($id_parent==='0'){
header("Location: index.php?action=visualiser&som=".$id_rub_voulu."");
}
//LORSQUE QUE LA RUBRIQUE À UN PARENT
ELSE {
$sql->query("SELECT id_rubrique,id_parent,titre FROM rubriques WHERE id_rubrique='".$id_parent."';","nom_ssrub");
$row_parent=$sql->fetch_object("nom_ssrub");
$nom_parent=$row_parent->titre;
$id_rub=$row_parent->id_rubrique;
$id_parent_dernier=$row_parent->id_parent;
IF($id_parent_dernier==='0'){
$this->fils_ariane .=' <a href="./index.php?action=visualiser&som='.$id_rub.'">'.$nom_parent.'</a> > '.$nom_rub_voulu;
}
ELSE{
$sql->query("SELECT id_rubrique,titre FROM rubriques WHERE id_rubrique='".$id_parent_dernier."';","nom_premrub");
$row_pr=$sql->fetch_object("nom_premrub");
$nom_pr=$row_pr->titre;
$id_rub_pr=$row_pr->id_rubrique;
$this->fils_ariane .=' <a href="./index.php?action=visualiser&som='.$id_rub_pr.'">'.$nom_pr.'</a> >';
$this->fils_ariane .=' <a href="./index.php?action=visualiser&rub='.$id_rub.'">'.$nom_parent.'</a> >';
$this->fils_ariane .=' '.$nom_rub_voulu;
}
}
}
?> |
Partager