hab hier im Forum nach einer Möglichkeit gesuch eine Horizontale Hauptnavigation oben und eine Unternavigation an der linkes Seite zu realisieren. Bedinung war aber das ich die Unternavigation auch frei in einen eigenen Container stecken und dann positionieren kann. Habe dann hier einen Beitrag von herby http://www.contenido.de/forum/viewtopic.php?t=2139 gelesen und den geänderten Quelltext von ihm in zwei Module gesteckt und ebenfalls leicht geändert. Konnte dadurch dann das eine Modul Hauptnavigation in den Container1 und das Modul Unternavigation in den Container2 stellen. Nach ändern der Dateien navfirst_off.html und navfirst_on.html in navfirst_h_off.html und navfirst_h_on.html aus dem Verzeichnis \templates und entfernen der Table-Tags hatte ich eine Horizontale Hauptnavigation. Nun kann ich die Navigation wie zum Beispiel auf der Seite http://www.abs-ag.de einsetzten.
Hier ist der Modulaufbau beider Module:
Code: Alles auswählen
/******************************************************************
*
* CONTENIDO MODUL
*
* Hauptnavigation - als unabhängiges Modul zur Unternavigation
*
* Zwei Module werden benötigt und hier beschrieben
*
* Mit Hilfe dieser zwei Module kann man zum Beispiel
* eine Horizontale Hauptnavigation in einem Container
* und eine vertikale Unternavigation in einem anderen Container
* oder umgekehrt realisieren (oben Haupt- und links oder rechts Unternavigation.
*
* Um die Haupnnavigation oder Unternavigation horizontal einzustellen
* kopiert die nav["" | "second" | "third"]_["off" | [on].html
* nach nav["" | "second" | "third"]_h_["off" | [on].html
* (z.B. cp navsecond_off.html navsecond_h_off.html
* - liegen im Pfad .../contenido/cms/templates/) und
* schmeisst dort die Tabellen-Tags raus (die stehen jetzt schon im Modul)
*
* Orginal
* Modulname : Navigation 1.1
* Author : Jan Lengowski
* Copyright : Contenido - four for business
* Created : 15-05-2003
* Modified :26-05-2003
* Modified : by herby
* Modified : by yodatortenboxer
*
*******************************************************************
/******************************************************************
*Hauptnavigation Eingabe:
******************************************************************/
/**
* Navigation
*
* INPUT
*
* @autor Jan Lengowski <Jan.Lengowski@4fb.de>
* @copyright four for business AG 2003
*/
?>
<table cellspacing="0" cellpadding="0" cellpadding="4">
<tr>
<td class="text">Baum wählen:</td>
<td>
<select name="CMS_VAR[0]">
<option value="0">-- kein --</option>
<?php
$sql = "SELECT
A.idcat,
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
C.idlang = '".$lang."' AND
B.idclient = '".$client."' AND
C.visible = 1 AND
A.level = '0'
ORDER BY
A.idtree";
$db->query($sql);
while ( $db->next_record() ) {
if ( "CMS_VALUE[0]" == $db->f("idcat") ) {
echo '<option selected="selected" value="'.$db->f("idcat").'">'.$db->f("name").'</option>';
} else {
echo '<option value="'.$db->f("idcat").'">'.$db->f("name").'</option>';
}
}
?>
</select>
</td>
</tr>
</table>
<?php
/******************************************************************
*Hauptnavigation Ausgabe:
******************************************************************/
<?php
// Hauptnav
/***********************************************
* CONTENIDO MODUL - OUTPUT
*
* Modulname : Navigation 1.1
* Author : Jan Lengowski
* Copyright : Contenido - four for business
* Created : 15-05-2003
* Modified : 26-05-2003
************************************************/
if ( !is_object($db2) ) {
$db2 = new DB_Contenido;
}
/**
* Check if a category is child
* of another category
*
* @return boolean true/false
* @author Jan Lengowski <Jan.Lengowski@4fb.de>
* @copyright four for business AG 2003
*/
function catIsChildOf($id, $idparent) {
global $cfg, $client, $lang;
$db = new DB_Contenido;
$parent = $id;
while ( $parent != 0 ) {
$sql = "SELECT
a.parentid
FROM
".$cfg["tab"]["cat"]." AS a,
".$cfg["tab"]["cat_lang"]." AS b
WHERE
a.idclient = '".$client."' AND
b.idlang = '".$lang."' AND
a.idcat = b.idcat AND
a.idcat = '".$parent."'";
$db->query($sql);
$db->next_record();
$parent = $db->f("parentid");
if ($parent == $idparent) {
return true;
}
}
return false;
}
if ( catIsChildOf($idcat, CMS_VALUE[0]) ) {
$sel_idcat = $idcat;
} else {
$sel_idcat = CMS_VALUE[0];
}
/* Include Template Class */
include_once($cfg["path"]["contenido"] . 'classes/class.template.php');
/**
* Array storing alle the
* navigation data
*/
$navitems = array();
/* Template Instance */
$tpl = new Template;
/**
* Recursive function for creating
* the navigation array
* @param Int $idcat Category id
*/
function nav($idcat) {
global $navitems, $client, $lang, $cfg;
$db = new DB_Contenido;
$db2 = new DB_Contenido;
$sql = "SELECT parentid FROM ".$cfg["tab"]["cat"]." WHERE idcat = '$idcat'";
$db->query($sql);
$db->next_record();
$parentid = $db->f("parentid");
if ( $parentid == 0 ) {
if ( $idcat != CMS_VALUE[0] ){
$navitems = array();
$sql = "SELECT
A.idcat,
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
B.parentid = 'CMS_VALUE[0]'
ORDER
BY A.idtree";
$db->query($sql);
while ($db->next_record()) {
/* Check for external redirects... */
$sql = "SELECT
a.external_redirect AS ext
FROM
".$cfg["tab"]["art_lang"]." AS a,
".$cfg["tab"]["cat_art"]." AS b,
".$cfg["tab"]["cat"]." AS c
WHERE
b.idcat = '".$db->f("idcat")."' AND
b.is_start = '1' AND
c.idclient = '".$client."' AND
c.idcat = b.idcat AND
a.idart = b.idart AND
a.idlang = '".$lang."'";
$db2->query($sql);
$db2->next_record();
$target = ( $db2->f("ext") == 0 ) ? '_self' : '_blank';
$navitems[$db->f("idcat")] = array("idcat" => $db->f("idcat"),
"name" => $db->f("name"),
"target" => $target);
}
}
return true;
}
$sql = "SELECT
A.idcat,
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
B.parentid = '$parentid'
ORDER BY
A.idtree";
$db->query($sql);
while ($db->next_record()) {
/* Check for external redirects... */
$sql = "SELECT
a.external_redirect AS ext
FROM
".$cfg["tab"]["art_lang"]." AS a,
".$cfg["tab"]["cat_art"]." AS b,
".$cfg["tab"]["cat"]." AS c
WHERE
b.idcat = '".$db->f("idcat")."' AND
b.is_start = '1' AND
c.idclient = '".$client."' AND
c.idcat = b.idcat AND
a.idart = b.idart AND
a.idlang = '".$lang."'";
$db2->query($sql);
$db2->next_record();
$target = ( $db2->f("ext") == 0 ) ? '_self' : '_blank';
$tmp_nav[$db->f("idcat")] = array("idcat" => $db->f("idcat"),
"name" => $db->f("name"),
"target" => $target);
}
$tmp_nav[$idcat]["sub"] = $navitems;
$navitems = $tmp_nav;
/* Function call */
nav($parentid);
} // end function
$sql = "SELECT
A.idcat,
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
B.parentid = '$sel_idcat'
ORDER BY
A.idtree";
$db->query($sql);
while ( $db->next_record() ) {
/* Check for external redirects... */
$sql = "SELECT
a.external_redirect AS ext
FROM
".$cfg["tab"]["art_lang"]." AS a,
".$cfg["tab"]["cat_art"]." AS b,
".$cfg["tab"]["cat"]." AS c
WHERE
b.idcat = '".$db->f("idcat")."' AND
b.is_start = '1' AND
c.idclient = '".$client."' AND
c.idcat = b.idcat AND
a.idart = b.idart AND
a.idlang = '".$lang."'";
$db2->query($sql);
$db2->next_record();
$target = ( $db2->f("ext") == 0 ) ? '_self' : '_blank';
$navitems[$db->f("idcat")] = array("idcat" => $db->f("idcat"),
"name" => $db->f("name"),
"target" => $target);
}
/* Create Navigation Array */
nav($sel_idcat);
/* Start Output buffer */
ob_start();
echo '<table cellspacing="0" cellpadding="0" border="0"><tr><td>';
foreach ($navitems as $key => $data) {
/* 1. Navigations Ebene */
$tpl->reset();
$tpl->set('d', 'NAME', $data['name']);
$tpl->set('d', 'TARGET', $data['target']);
$tpl->set('d', 'HREF', $sess->url('front_content.php?idcat='.$data['idcat']));
$tpl->next();
if ($idcat == $data['idcat'] || is_array($data['sub'])) {
$tpl->generate('templates/navfirst_h_on.html');
} else {
$tpl->generate('templates/navfirst_h_off.html');
}
if (is_array($data['sub'])) {
$tmp_data = array();
$tmp_data = $data;
} // end if
} // end foreach
echo '</td></tr></table>';
/* Read out buffer */
$html = ob_get_contents();
/* Clean buffer */
ob_end_clean();
/* Output buffer-contents */
echo $html;
?>
/******************************************************************
*
* Unternavigation Zweites benötigtes Modul
* -abhängig von der Hauptnavigation
* -als zweites freipositionierbares Modul einsetzbar
*
******************************************************************/
/******************************************************************
* Unternavigation Eingabe: bleibt Leer
******************************************************************/
/******************************************************************
* Unternavigation Ausgabe:
******************************************************************/
<?php
if (is_array($tmp_data['sub'])) {
$data = $tmp_data;
echo '<table cellspacing="0" cellpadding="0" border="0"><tr><td>';
foreach ($data['sub'] as $key => $data) {
/* 2. Navigations Ebene */
$tpl->reset();
$tpl->set('d', 'NAME', $data['name']);
$tpl->set('d', 'TARGET', $data['target']);
$tpl->set('d', 'HREF', $sess->url('front_content.php?idcat='.$data['idcat']));
$tpl->next();
if ($idcat == $data['idcat'] || is_array($data['sub'])) {
$tpl->generate('templates/navsecond_h_on.html');
} else {
$tpl->generate('templates/navsecond_h_off.html');
}
if (is_array($data['sub'])) {
$tmp_data2 = array();
$tmp_data2 = $data;
}
} // end for each
echo '</td></tr></table>';
} // end if
if (is_array($tmp_data2['sub'])) {
$data = $tmp_data2;
echo '<table cellspacing="0" cellpadding="0" border="0"><tr><td>';
foreach ($data['sub'] as $key => $data) {
/* 3. Navigations Ebene */
$tpl->reset();
$tpl->set('d', 'NAME', $data['name']);
$tpl->set('d', 'TARGET', $data['target']);
$tpl->set('d', 'HREF', $sess->url('front_content.php?idcat='.$data['idcat']));
$tpl->next();
if ($idcat == $data['idcat']) {
$tpl->generate('templates/navthird_h_on.html');
} else {
$tpl->generate('templates/navthird_h_off.html');
}
} // end foreach
echo '</td></tr></table>';
} // end if ?>