Index du Forum » » Questions

Auteur

Patauge encore, création menu dynamique ds images..
rockandsnow74
31    

  Posté : 10-12-2012 21:49

Voici le script du meta:
function MM_MakeMenuSections($rubric) {
global $NPDS_Prefix;
global $admin, $user;
$userinfo = explode(":",base_64_decode($xuser));
if ($admin) {
$query = "SELECT rubid, rubname, ordre FROM ".$NPDS_Prefix."rubriques WHERE enligne='1' and rubname<>'Divers' ORDER BY ordre";
} else {
$query = "SELECT rubid, rubname, ordre FROM ".$NPDS_Prefix."rubriques WHERE enligne='1' and rubname<>'Divers' ORDER BY ordre";
}
$result = sql_query($query);
$nb_rubrique = sql_num_rows($result);
"zlien = new Array;\n";
"menu = new Array;\n";
"menurubric = new Array;\n";
for ($i=0; $i<=($nb_rubrique-1); $i++) {
"zlien[$i] = new Array;\n";
}

$b = 1;
while($row = sql_fetch_row($result)) {
$rubid = $row[0];

$rubname = stripslashes($row[1]);
$rubname = aff_langue(str_replace("'","’",$rubname));
$ordre = $row[2];
"menu[$b] = '$rubname';";
"menurubric[$b] = '$rubid';";
$a = 0;
$result2 = sql_query("SELECT secid, secname, userlevel FROM ".$NPDS_Prefix."sections WHERE rubid='$rubid' ORDER BY ordre");
$nb_sections = sql_num_rows($result2);
if ($nb_sections < 1) {
echo "<ul><li><a class=\"menu\" href=\"sections.php?rubric=$rubid\">".aff_langue($rubname).&q uot;</a></li></ul>\n";
} else {
echo "<ul><li><a class=\"menu\" href=\"sections.php?rubric=$rubid\">".aff_langue($rubname).&q uot;</a></li><ul>\n";
}
while($row2 = sql_fetch_row($result2)) {
$tmp_auto=explode(",",$row2[2]);
while (list(,$userlevel)=each($tmp_auto)) {
$okprintLV1=autorisation($userlevel);
if ($okprintLV1) break;
}
if ($okprintLV1) {
$secid = $row2[0];
$secname = stripslashes($row2[1]);
$secname = str_replace("'","’",$secname);
$query3 = "SELECT artid FROM ".$NPDS_Prefix."seccont WHERE secid='$secid'";
$result3 = sql_query($query3);
$nb_article = sql_num_rows($result3);
if ($nb_article > 0) {
echo "<li><a class=\"noir\" href=\"sections.php?op=listarticles&secid=$secid\">".aff_ langue($secname)."</a></li>\n";
$a++;
}
}
}
$b++;
if ($nb_sections !=0) {
echo "</ul>";
}
echo "</ul>";
}



Cet article provient de NPDS

http://www.npds.org/viewtopic.php?topic=25699&forum=9