Hallo Seelauer,Seelauer hat geschrieben:Hallo Helga,
meines Erachtens hat es Ortwin so vorgeschlagen:
Suche in Deinem Modul den Anfang der Function
function nav_feld($cat, $Level)
{
global $client, $lang, $cfg, $idcat;
...
und füge vor dem Functions-Beginn folgenden Befehl ein
if (!function_exists("nav_feld"))
{
function nav_feld($cat, $Level)
{
global $client, $lang, $cfg, $idcat;
...
und füge am Ende der Function ein
}
Diese Ergänzung bei jeder Function mit Namen "nav_feld" bzw. bei Dir in die beiden Module, evtl. auch bei function liste($array, $indent = " ")
{
nach eingier Pause geht es nun weiter mit dem Projekt. Inzwischen werden beide Navis angezeigt. die erste funktioniert wie auch gewünscht, aber die zweite Navigation erhält nicht die im Modul angegebene id und somit auch nicht die class. also bei der Listenausgabe scheint es noch einen Fehler zu geben. du hast geschrieben, dass ich if (!function_exists("nav_feld")) { auch bei der function liste einfügen sollte. da musste ich doch dann if (!function_exists("liste")) { schreiben oder? dieser Versuch brachte jedenfalls keinerlei Wirkung.
ich poste mal beide Module:
1. Navigation horizontal mit einer anderen id bzw. class für ul
Code: Alles auswählen
<?php
/***********************************************
* CONTENIDO MODUL - OUTPUT
*
* Modulname : DHTML Navi auf Spry1.6.1.-Basis
* Author(s) : Ralf Fleischer
* WWW-Adress : http://www.xtended-cooperation.de
* Mail : info@xtended-cooperation.de
* Created : 12-05-2008
* Modified : 21-05-2008, Ralf Fleischer
* Modified : 15-11-2009, Axel Womatschka: FrontEndUser-Berechtigungen werden berücksichtigt
* ************************************************/
// include Contenido_FrontendNavigation class
cInclude('classes', 'Contenido_FrontendNavigation/Contenido_FrontendNavigation.class.php');
cInclude('classes', 'Contenido_FrontendNavigation/Contenido_FrontendNavigation_Breadcrumb.class.php');
cInclude('classes', 'class.frontend.permissions.php');
cInclude('classes', 'class.frontend.groups.php');
cInclude('classes', 'class.frontend.users.php');
$hauptkategorie = getEffectiveSetting('navigation', 'idcat-jquery', 1);
$MaxLevel = getEffectiveSetting('navigation', 'idcat-jquery-maxlevel', 10);
//$hauptkategorie = "CMS_VALUE[0]";
$navitems = array();
if (!function_exists("nav_feld"))
{
function nav_feld ($cat,$Level) {
global $user, $client, $lang, $cfg, $idcat, $auth;
$FrontendPermissionCollection = new FrontendPermissionCollection;
if (!is_object($db)) {
$db = new DB_Contenido;
}
$sql = "SELECT
A.idcat,
A.level,
B.parentid,
C.name,
C.public,
C.idcatlang
FROM
".$cfg["tab"]["cat_tree"]." AS A,
".$cfg["tab"]["cat"]." AS B,
".$cfg["tab"]["cat_lang"]." AS C
WHERE
A.idcat = B.idcat AND
B.idcat = C.idcat AND
B.idclient = '$client' AND
C.idlang = '$lang' AND
C.visible = '1' AND
A.level <= $Level AND
B.parentid = '$cat'
ORDER BY
A.idtree";
$db->query($sql);
while ( $db->next_record() ) {
$aktiv = "";
$cat_id = $db->f("idcat");
$cat_idlang = $db->f("idcatlang");
$visible=false;
if($db->f("public")!=0){
$visible = true;
}elseif(($auth->auth['uid']!='')&&($auth->auth['uid']!='nobody')){
$FrontendGroupMemberCollection = new FrontendGroupMemberCollection;
$FrontendGroupMemberCollection->setWhere("idfrontenduser",$auth->auth['uid']);
$FrontendGroupMemberCollection->query();
$groups = array();
while ($member = $FrontendGroupMemberCollection->next()){
$groups[] = $member->get("idfrontendgroup");
}
}
if(count($groups)>0){
for($i=0;$i<count($groups);$i++){
if($FrontendPermissionCollection->checkPerm($groups[$i],'category','access',$cat_idlang, true)){
$visible=true;
}
}
}
if($visible){
$sub_feld = nav_feld($db->f("idcat"),$Level);
if ($db->f("idcat") == $idcat) $aktiv = "active";
elseif ($sub_feld["activepath"]) $aktiv = "activepath";
$nav_feld[] = array("idcat" => $db->f("idcat"),
"name" => $db->f("name"),
"active" => $aktiv,
"sub" => $sub_feld);
if ($aktiv != "") $activepath = $aktiv;
}
}
$rv = array("feld" => $nav_feld,
"activepath" => $activepath);
return $rv;
} // end function
function liste ($array, $indent = " ")
{
global $first,$Level,$LevelMax;
if (is_array($array["feld"])) {
if ($first) {
echo $indent . "<ul class=\"menu\">\n";
$first = 0;
}
else echo $indent . "<ul class=\"menu\">\n";
foreach ($array["feld"] as $menupunkt) {
if ($menupunkt["active"] == "active") echo $indent . $indent . "<li class=\"active\">\n";
elseif ($menupunkt["active"] == "activepath") echo $indent . $indent . "<li class=\"activepath\">\n";
else echo $indent . $indent . "<li class=\"passiv\">\n";
if (is_array($menupunkt["sub"]["feld"])) {
echo $indent . $indent . $indent . "<a class=\"parent\" href=\"front_content.php?idcat=" . $menupunkt["idcat"]. "\"><span>" . $menupunkt["name"] . "</span></a>\n";
liste($menupunkt["sub"], $indent." ");
}
else echo $indent . $indent . $indent . "<a href=\"front_content.php?idcat=" . $menupunkt["idcat"] . "\"><span>" . $menupunkt["name"] . "</span></a>\n";
echo $indent . $indent . "</li>\n";
}
echo $indent . "</ul>\n";
}
} // end function
} // end if
/* Create Navigation Array */
$navitems = nav_feld($hauptkategorie,$MaxLevel);
$first = 1;
liste($navitems);
?>
Code: Alles auswählen
<?php
/***********************************************
* CONTENIDO MODUL - OUTPUT
*
* Modulname : DHTML Navi auf Spry1.6.1.-Basis
* Author(s) : Ralf Fleischer
* WWW-Adress : http://www.xtended-cooperation.de
* Mail : info@xtended-cooperation.de
* Created : 12-05-2008
* Modified : 21-05-2008, Ralf Fleischer
* ************************************************/
// include Contenido_FrontendNavigation class
cInclude('classes', 'Contenido_FrontendNavigation/Contenido_FrontendNavigation.class.php');
cInclude('classes', 'Contenido_FrontendNavigation/Contenido_FrontendNavigation_Breadcrumb.class.php');
$hauptkategorie = getEffectiveSetting('navigation', 'idcat-dhtml', 116);
$MaxLevel = getEffectiveSetting('navigation', 'idcat-dhtml-maxlevel', 10);
//$hauptkategorie = "CMS_VALUE[0]";
$navitems = array();
if (!function_exists("nav_feld"))
{
function nav_feld ($cat,$Level) {
global $client, $lang, $cfg, $idcat;
if (!is_object($db)) {
$db = new DB_Contenido;
}
$sql = "SELECT
A.idcat,
A.level,
B.parentid,
C.name
FROM
".$cfg["tab"]["cat_tree"]." AS A,
".$cfg["tab"]["cat"]." AS B,
".$cfg["tab"]["cat_lang"]." AS C
WHERE
A.idcat = B.idcat AND
B.idcat = C.idcat AND
B.idclient = '$client' AND
C.idlang = '$lang' AND
C.visible = '1' AND
A.level <= $Level AND
B.parentid = '$cat'
ORDER BY
A.idtree";
$db->query($sql);
while ( $db->next_record() ) {
$aktiv = "";
$sub_feld = nav_feld($db->f("idcat"),$Level);
if ($db->f("idcat") == $idcat) $aktiv = "active";
elseif ($sub_feld["activepath"]) $aktiv = "activepath";
$nav_feld[] = array("idcat" => $db->f("idcat"),
"name" => $db->f("name"),
"active" => $aktiv,
"sub" => $sub_feld);
if ($aktiv != "") $activepath = $aktiv;
}
$rv = array("feld" => $nav_feld,
"activepath" => $activepath);
return $rv;
} // end function
function liste ($array, $indent = " ")
{
global $first,$Level,$LevelMax;
if (is_array($array["feld"])) {
if ($first) {
echo $indent . "<ul id=\"MenuBar1\" class=\"MenuBarVertical\">\n";
$first = 0;
}
else echo $indent . "<ul>\n";
foreach ($array["feld"] as $menupunkt) {
if ($menupunkt["active"] == "active") echo $indent . $indent . "<li class=\"active\">\n";
elseif ($menupunkt["active"] == "activepath") echo $indent . $indent . "<li class=\"activepath\">\n";
else echo $indent . $indent . "<li class=\"passiv\">\n";
if (is_array($menupunkt["sub"]["feld"])) {
echo $indent . $indent . $indent . "<a class=\"MenuBarItemSubmenu\" href=\"front_content.php?idcat=" . $menupunkt["idcat"] . "\">" . $menupunkt["name"] . "</a>\n";
liste($menupunkt["sub"], $indent." ");
}
else echo $indent . $indent . $indent . "<a href=\"front_content.php?idcat=" . $menupunkt["idcat"] . "\">" . $menupunkt["name"] . "</a>\n";
echo $indent . $indent . "</li>\n";
}
echo $indent . "</ul>\n";
}
} // end function
} // end if
/* Create Navigation Array */
$navitems = nav_feld($hauptkategorie,$MaxLevel);
$first = 116;
liste($navitems);
?>
Helga