Hallo Leute,
ich möchte gerne auf eine Internetseite zwei dhtml Navigationen einsetzen. Deshalb habe ich mir einfach mal zwei Versionen installiert.
vp Navigation und xtcSpryDHTMLNaviHorizontal
Wenn ich jetzt aber beide Navigationen im Einsatz habe bekomme ich Probleme mit der "function nav_feld" die in beiden Modulen angesprochen wird.
Ich bin nun aber kein Programmier-Crack und deshalb habe ich die Frage an die Cracks unter euch, gibt es eine Möglichkeit entweder eine Navigation von beiden zweimal einzusetzen oder die beiden unterschiedlichen.
Vielen Dank für eure Hilfe.
dhtml navigationen
-
- Beiträge: 3215
- Registriert: Do 21. Okt 2004, 11:08
- Wohnort: Augsburg
- Hat sich bedankt: 4 Mal
- Danksagung erhalten: 17 Mal
- Kontaktdaten:
Re: dhtml navigationen
Du musst dafür sorgen, dass die Funktion nur 1 mal vorkommt, dass kannst du erreichen, wenn du in der Modulausgabe die Funktion nav_feld() mit eine if-Bedingung packst.Luesch1 hat geschrieben:...Wenn ich jetzt aber beide Navigationen im Einsatz habe bekomme ich Probleme mit der "function nav_feld" die in beiden Modulen angesprochen wird....
Code: Alles auswählen
if (function_exists('nav_feld') == false) {
// funktion gibt es noch nicht
function nav_feld ($cat) {
...
}
}
Gruß
xmurrix
Danke schon mal für die Antwort. Wie gesagt bin ich kein großer Programmier. Mein Code sieht jetzt folgender maßen aus:
Als Fehlermeldung erhalte ich jetzt noch:
Was habe ich falsch gemacht 
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', 1);
$MaxLevel = getEffectiveSetting('navigation', 'idcat-dhtml-maxlevel', 10);
//$hauptkategorie = "CMS_VALUE[0]";
$navitems = array();
if (function_exists('function nav_feld')== false)
{
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;
}
}
if (function_exists('function liste')== false)
{
function liste ($array, $indent = " ")
{
global $first,$Level,$LevelMax;
if (is_array($array["feld"]))
{
if ($first) {
echo $indent . "<ul id=\"MenuBar1\" class=\"MenuBarHorizontal\">\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";
}
}
}
/* Create Navigation Array */
$navitems = nav_feld($hauptkategorie,$MaxLevel);
$first = 1;
liste($navitems);
?>
Code: Alles auswählen
Fatal error: Cannot redeclare nav_feld() (previously declared in /home/httpd/vhosts/domain.de/httpdocs/neu/contenido/includes/include.con_editcontent.php(640) : eval()'d code:248) in /home/httpd/vhosts/domain.de/httpdocs/neu/contenido/includes/include.con_editcontent.php(640) : eval()'d code on line 428

-
- Beiträge: 3626
- Registriert: Di 12. Okt 2004, 20:00
- Wohnort: Voerde (Niederrhein)
- Kontaktdaten:
Am besten nochmal die Antwort von xmurrix mit deinem Code vergleichen. Es sollte:Luesch1 hat geschrieben:Was habe ich falsch gemacht
Code: Alles auswählen
if (function_exists('nav_feld') == false) {
Code: Alles auswählen
if (function_exists('function nav_feld') == false) {