Sortierung der Kategorien durcheinandergeworfen
Sortierung der Kategorien durcheinandergeworfen
Hallo. Hab ein Problem bei der zweigeteilten Navigation. Hierbei wird die Reihenfolge der Kategorien verändert, sobald ich einen Menüpunkt auswähle. Sitze seid Freitag an diesem Problem und komme nicht weiter. Vielleicht weiß jemand im Forum mir zu helfen.
Nachfolgend der Code der beiden Navigationsmodule:
/******************************************************************
*
* 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
<?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_on.html');
} else {
$tpl->generate('templates/navsecond_off.html');
}
if (is_array($data['sub'])) {
echo '<tr><td>';
foreach ($data['sub'] as $key2 => $data2) {
/* 3. Navigations Ebene */
$tpl->reset();
$tpl->set('d', 'NAME', $data2['name']);
$tpl->set('d', 'TARGET', $data2['target']);
$tpl->set('d', 'HREF', $sess->url('front_content.php?idcat='.$data2['idcat']));
$tpl->next();
if ($idcat == $data2['idcat']) {
$tpl->generate('templates/navthird_on.html');
} else {
$tpl->generate('templates/navthird_off.html');
}
} // end foreach
echo '</td></tr>';
} // end if
} // end for each
echo '</td></tr></table>';
} // end if
?>
Vielen Dank.
Nachfolgend der Code der beiden Navigationsmodule:
/******************************************************************
*
* 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
<?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_on.html');
} else {
$tpl->generate('templates/navsecond_off.html');
}
if (is_array($data['sub'])) {
echo '<tr><td>';
foreach ($data['sub'] as $key2 => $data2) {
/* 3. Navigations Ebene */
$tpl->reset();
$tpl->set('d', 'NAME', $data2['name']);
$tpl->set('d', 'TARGET', $data2['target']);
$tpl->set('d', 'HREF', $sess->url('front_content.php?idcat='.$data2['idcat']));
$tpl->next();
if ($idcat == $data2['idcat']) {
$tpl->generate('templates/navthird_on.html');
} else {
$tpl->generate('templates/navthird_off.html');
}
} // end foreach
echo '</td></tr>';
} // end if
} // end for each
echo '</td></tr></table>';
} // end if
?>
Vielen Dank.
Sortierung der Kategorien durcheinandergeworfen
Hier zum Beispiel die Website wo dieses Problem auftritt:
http://132.187.84.125/contenido/mba-bizint
http://132.187.84.125/contenido/mba-bizint
-
- Beiträge: 5478
- Registriert: Di 2. Mär 2004, 21:11
- Wohnort: Halchter, wo sonst? ;-)
- Kontaktdaten:
-
- Beiträge: 4316
- Registriert: Do 30. Jun 2005, 22:56
- Wohnort: Eltmann, Unterfranken, Bayern
- Hat sich bedankt: 6 Mal
- Danksagung erhalten: 4 Mal
- Kontaktdaten:
Halchteranerin hat geschrieben:Bitte keine unaufgeforderten Privatnachrichten mit Hilfegesuchen schicken. WENN ich helfen kann, dann mache ich das im Forum, da ich auch alle Postings lese. Danke!


und jetzt abber





ConLite 3.0.0-dev, alternatives und stabiles Update von Contenido 4.8.x unter PHP 8.x - Download und Repo auf Gitport.de
phpBO Search Advanced - das Suchwort-Plugin für CONTENIDO 4.9
Mein Entwickler-Blog
phpBO Search Advanced - das Suchwort-Plugin für CONTENIDO 4.9
Mein Entwickler-Blog
Re: Sortierung der Kategorien durcheinandergeworfen
[quote="rscharrer"]Hallo. Hab ein Problem bei der zweigeteilten Navigation. Hierbei wird die Reihenfolge der Kategorien verändert, sobald ich einen Menüpunkt auswähle. Sitze seid Freitag an diesem Problem und komme nicht weiter. Vielleicht weiß jemand im Forum mir zu helfen.
Nachfolgend der Code der beiden Navigationsmodule:
[code]
/******************************************************************
*
* 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
[/code]
[code]
<?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;
?>
[/code]
[code]
/******************************************************************
*
* 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_on.html');
} else {
$tpl->generate('templates/navsecond_off.html');
}
if (is_array($data['sub'])) {
echo '<tr><td>';
foreach ($data['sub'] as $key2 => $data2) {
/* 3. Navigations Ebene */
$tpl->reset();
$tpl->set('d', 'NAME', $data2['name']);
$tpl->set('d', 'TARGET', $data2['target']);
$tpl->set('d', 'HREF', $sess->url('front_content.php?idcat='.$data2['idcat']));
$tpl->next();
if ($idcat == $data2['idcat']) {
$tpl->generate('templates/navthird_on.html');
} else {
$tpl->generate('templates/navthird_off.html');
}
} // end foreach
echo '</td></tr>';
} // end if
} // end for each
echo '</td></tr></table>';
} // end if
?>
[/code]
Vielen Dank.[/quote]
Nachfolgend der Code der beiden Navigationsmodule:
[code]
/******************************************************************
*
* 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
[/code]
[code]
<?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;
?>
[/code]
[code]
/******************************************************************
*
* 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_on.html');
} else {
$tpl->generate('templates/navsecond_off.html');
}
if (is_array($data['sub'])) {
echo '<tr><td>';
foreach ($data['sub'] as $key2 => $data2) {
/* 3. Navigations Ebene */
$tpl->reset();
$tpl->set('d', 'NAME', $data2['name']);
$tpl->set('d', 'TARGET', $data2['target']);
$tpl->set('d', 'HREF', $sess->url('front_content.php?idcat='.$data2['idcat']));
$tpl->next();
if ($idcat == $data2['idcat']) {
$tpl->generate('templates/navthird_on.html');
} else {
$tpl->generate('templates/navthird_off.html');
}
} // end foreach
echo '</td></tr>';
} // end if
} // end for each
echo '</td></tr></table>';
} // end if
?>
[/code]
Vielen Dank.[/quote]
-
- Beiträge: 1536
- Registriert: Fr 20. Aug 2004, 10:07
- Kontaktdaten:
zur besseren übersicht solltest du jeden deiner
Code: Alles auswählen
tags auch schliessen
sonst ließt sich das keiner so gerne durch
greets
greets
Re: Sortierung der Kategorien durcheinandergeworfen
rscharrer hat geschrieben:rscharrer hat geschrieben:Hallo. Hab ein Problem bei der zweigeteilten Navigation. Hierbei wird die Reihenfolge der Kategorien verändert, sobald ich einen Menüpunkt auswähle. Sitze seid Freitag an diesem Problem und komme nicht weiter. Vielleicht weiß jemand im Forum mir zu helfen.
Nachfolgend der Code der beiden Navigationsmodule: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
Code: Alles auswählen
<?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; ?>
Vielen Dank.Code: Alles auswählen
/****************************************************************** * * 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_on.html'); } else { $tpl->generate('templates/navsecond_off.html'); } if (is_array($data['sub'])) { echo '<tr><td>'; foreach ($data['sub'] as $key2 => $data2) { /* 3. Navigations Ebene */ $tpl->reset(); $tpl->set('d', 'NAME', $data2['name']); $tpl->set('d', 'TARGET', $data2['target']); $tpl->set('d', 'HREF', $sess->url('front_content.php?idcat='.$data2['idcat'])); $tpl->next(); if ($idcat == $data2['idcat']) { $tpl->generate('templates/navthird_on.html'); } else { $tpl->generate('templates/navthird_off.html'); } } // end foreach echo '</td></tr>'; } // end if } // end for each echo '</td></tr></table>'; } // end if ?>