Navigation Module
Navigation Module
Hello,
I have a question about Hauptnavigation (Navigation 1.1) module.
I need 2 different Navigation Menus on 1 page, so that each of them would show content of different Categories. If I put 2 Navigation modules in Template then, the second one doesnt work, from the point second module must start the HTML code is cut and doesnt continue.
So I am interested if it is possible to have 2 different navigation menus, on 1 page and how to do that.
I would be thankfull for any information you can provide.
Thank you in advance
CZealot
----
added
If this cannot be done with this module please redirect me to other module... or maybe it can be done with 2 different modules 1 menu with module1 and another with module2...
I have a question about Hauptnavigation (Navigation 1.1) module.
I need 2 different Navigation Menus on 1 page, so that each of them would show content of different Categories. If I put 2 Navigation modules in Template then, the second one doesnt work, from the point second module must start the HTML code is cut and doesnt continue.
So I am interested if it is possible to have 2 different navigation menus, on 1 page and how to do that.
I would be thankfull for any information you can provide.
Thank you in advance
CZealot
----
added
If this cannot be done with this module please redirect me to other module... or maybe it can be done with 2 different modules 1 menu with module1 and another with module2...
-
- Beiträge: 5478
- Registriert: Di 2. Mär 2004, 21:11
- Wohnort: Halchter, wo sonst? ;-)
- Kontaktdaten:
the values from the input script and from the output script must correspond to each other. and they must be unique within the context of a template and module combination.
CMS_VAR[index] is used in the input script to get the value from the form to configurate the module. you'll find a CMS_VALUE[index] in the input script as well. its intention is to fill the form with the values you enterred before.
so, what you have to do is the following:
(1) make a copy of the module
(2) give it a unique name
(3) change the indexes of the variable in the copy of the module. if it has been 0 change it to 1 or any value above. make sure not to use a value that is already in use in the script. remember that CMS_VAR[n] of the input script corresponds to CMS_VALUE[n] in the output script. the indexes in the input script must be the same as in the output script.
(4) now you should be able to use both modules within a single template.
hope this helps!
regards,
andreas
CMS_VAR[index] is used in the input script to get the value from the form to configurate the module. you'll find a CMS_VALUE[index] in the input script as well. its intention is to fill the form with the values you enterred before.
so, what you have to do is the following:
(1) make a copy of the module
(2) give it a unique name
(3) change the indexes of the variable in the copy of the module. if it has been 0 change it to 1 or any value above. make sure not to use a value that is already in use in the script. remember that CMS_VAR[n] of the input script corresponds to CMS_VALUE[n] in the output script. the indexes in the input script must be the same as in the output script.
(4) now you should be able to use both modules within a single template.
hope this helps!
regards,
andreas
aitsu.org :: schnell - flexibel - komfortabel :: Version 2.2.0 (since June 22, 2011) (jetzt mit dual license GPL/kommerziell)
I've tried that, but its not working
.
Here is what I do:
This is the original Module Hauptnavigation, in which I made minor changes in Input module, to display Text in English, but its not a problem as there is a same problem with original module.
Module for my "Main" menu:
Module Name - Main Navigation
Now I Create new module, name it "Resources Navigation" and changed the Variable numbers in it from "0" to "4321". I have tried several values including - 1, 2 and 3.
And here is what I get:
In my template only 2 of this modules are selected currently so they have conflict with each other, not any other module.
So am I doing something wrong ? Have I forgotten something or missed a coma somewhere... ?
Again the problem is that HTML code stops at the point where the second module must start, and nothing is show after that point.

Here is what I do:
This is the original Module Hauptnavigation, in which I made minor changes in Input module, to display Text in English, but its not a problem as there is a same problem with original module.
Module for my "Main" menu:
Module Name - Main Navigation
Code: Alles auswählen
/**
* 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">Select Category:</td>
<td>
<select name="CMS_VAR[0]">
<option value="0">-- None --</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
/***********************************************
* 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
*/
if (!function_exists("catIsChildOf"))
{
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">';
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_on.html');
} else {
$tpl->generate('templates/navfirst_off.html');
}
if (is_array($data['sub'])) {
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'])) {
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_on.html');
} else {
$tpl->generate('templates/navthird_off.html');
}
} // end foreach
} // end if
} // end foreach
} // end if
} // end foreach
echo '</table>';
/* Read out buffer */
$html = ob_get_contents();
/* Clean buffer */
ob_end_clean();
/* Output buffer-contents */
echo $html;
?>
And here is what I get:
Code: Alles auswählen
/**
* 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">Select Category:</td>
<td>
<select name="CMS_VAR[4321]">
<option value="0">-- None --</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[4321]" == $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
/***********************************************
* 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
*/
if (!function_exists("catIsChildOf"))
{
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[4321]") ) {
$sel_idcat = $idcat;
} else {
$sel_idcat = "CMS_VALUE[4321]";
}
/* 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[4321]" ){
$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[4321]'
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">';
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_on.html');
} else {
$tpl->generate('templates/navfirst_off.html');
}
if (is_array($data['sub'])) {
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'])) {
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_on.html');
} else {
$tpl->generate('templates/navthird_off.html');
}
} // end foreach
} // end if
} // end foreach
} // end if
} // end foreach
echo '</table>';
/* Read out buffer */
$html = ob_get_contents();
/* Clean buffer */
ob_end_clean();
/* Output buffer-contents */
echo $html;
?>
So am I doing something wrong ? Have I forgotten something or missed a coma somewhere... ?

Again the problem is that HTML code stops at the point where the second module must start, and nothing is show after that point.
-
- Beiträge: 19
- Registriert: Sa 28. Aug 2004, 14:23
- Wohnort: Karlsruhe
- Kontaktdaten: