Navigation with sublayer
Navigation with sublayer
Hi,
I have a navigation structure
1. Products
1.1 Product 1
1.2 Product 2
2. Services
2.1 Service 1
2.2 Service 2
I want to use a 'hauptnavigation' which always shows the second layer aswell without the need of clicking the categorie.
Example of website hauptnavigation:
Products
Product 1
Product 2
Services
Service 1
Service 2
Does anyone know how to do this?
Thanks !
John
I have a navigation structure
1. Products
1.1 Product 1
1.2 Product 2
2. Services
2.1 Service 1
2.2 Service 2
I want to use a 'hauptnavigation' which always shows the second layer aswell without the need of clicking the categorie.
Example of website hauptnavigation:
Products
Product 1
Product 2
Services
Service 1
Service 2
Does anyone know how to do this?
Thanks !
John
Hello,
this should work:
Module: first two levels
Description: shows the first two levels (without 'home') of the navigation, using the nav*.html-files; based upon the navigation-module of Jan Legowski
Input: none
Output:
The module could be extended by choosing the number of levels and the home-directory in the input-area.
Greetings
Andreas
this should work:
Module: first two levels
Description: shows the first two levels (without 'home') of the navigation, using the nav*.html-files; based upon the navigation-module of Jan Legowski
Input: none
Output:
Code: Alles auswählen
<?php
echo '<table cellspacing="0" cellpadding="0" border="0">';
// template klasse includen
include_once($cfg["path"]["contenido"] . 'classes/class.template.php');
// template instanz
$tpl = new Template;
$sql = "SELECT CATTREE.idcat, CATTREE.level, CATLANG.name
FROM ".$cfg["tab"]["cat_tree"]." AS CATTREE, ".$cfg["tab"]["cat"]." AS CAT, ".$cfg["tab"]["cat_lang"]." AS CATLANG
WHERE CATTREE.idcat=CAT.idcat AND CAT.idcat=CATLANG.idcat AND CATLANG.idlang='$lang' AND CAT.idclient='$client' AND CATLANG.visible=1
AND (CATTREE.level='1' OR CATTREE.level='2')
ORDER BY CATTREE.idtree";
$db->query($sql);
while ( $db->next_record() )
{
$tpl->reset();
$tpl->set('d', 'NAME', $db->f("name"));
$tpl->set('d', 'HREF', $sess->url('front_content.php?idcat='.$db->f("idcat").'&client='.$client.'&la'.'ng='.$lang));
$tpl->next();
switch ($db->f("level"))
{
case 1:
if ($idcat == $db->f("idcat"))
{
$tpl->generate('templates/navfirst_on.html');
} else {
$tpl->generate('templates/navfirst_off.html');
}
break;
case 2:
if ($idcat == $db->f("idcat"))
{
$tpl->generate('templates/navsecond_on.html');
} else {
$tpl->generate('templates/navsecond_off.html');
}
break;
}
}
echo '</table>';
?>
Greetings
Andreas
Hello,
take the input-module of Jan Legowski's Navigation and then the following output-module:
This should work
Andreas
take the input-module of Jan Legowski's Navigation and then the following output-module:
Code: Alles auswählen
<?php
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;
}
echo '<table cellspacing="0" cellpadding="0" border="0">';
// template klasse includen
include_once($cfg["path"]["contenido"] . 'classes/class.template.php');
// template instanz
$tpl = new Template;
$sql = "SELECT CATTREE.idcat, CATTREE.level, CATLANG.name
FROM ".$cfg["tab"]["cat_tree"]." AS CATTREE, ".$cfg["tab"]["cat"]." AS CAT, ".$cfg["tab"]["cat_lang"]." AS CATLANG
WHERE CATTREE.idcat=CAT.idcat AND CAT.idcat=CATLANG.idcat AND CATLANG.idlang='$lang' AND CAT.idclient='$client' AND CATLANG.visible=1
AND (CATTREE.level='1' OR CATTREE.level='2')
ORDER BY CATTREE.idtree";
$db->query($sql);
while ( $db->next_record() )
{
if ( catIsChildOf($db->f("idcat"), CMS_VALUE[0]) )
{
$tpl->reset();
$tpl->set('d', 'NAME', $db->f("name"));
$tpl->set('d', 'HREF', $sess->url('front_content.php?idcat='.$db->f("idcat").'&client='.$client.'&la'.'ng='.$lang));
$tpl->next();
switch ($db->f("level"))
{
case 1:
if ($idcat == $db->f("idcat"))
{
$tpl->generate('templates/navfirst_on.html');
} else {
$tpl->generate('templates/navfirst_off.html');
}
break;
case 2:
if ($idcat == $db->f("idcat"))
{
$tpl->generate('templates/navsecond_on.html');
} else {
$tpl->generate('templates/navsecond_off.html');
}
break;
}
}
}
echo '</table>';
?>
Andreas
-
- Beiträge: 4
- Registriert: Di 9. Dez 2003, 12:59
- Kontaktdaten:
-
- Beiträge: 4
- Registriert: Di 9. Dez 2003, 12:59
- Kontaktdaten:
Hi,
try this (not tested!):
1. Replace the second SQL-statement by
2. Place this between $tpl->reset(); and $tpl->next();
So, when the starting article of a category has an external redirect the link should open in a new window.
I'm not sure but this should work
Andreas
try this (not tested!):
1. Replace the second SQL-statement by
Code: Alles auswählen
$sql = "SELECT CATTREE.idcat, CATTREE.level, CATLANG.name, ARTLANG.redirect
FROM ".$cfg["tab"]["cat_tree"]." AS CATTREE, ".$cfg["tab"]["cat"]." AS CAT, ".$cfg["tab"]["cat_lang"]." AS CATLANG,
".$cfg["tab"]["cat_art"]." AS CATART, ".$cfg["tab"]["art_lang"]." AS ARTLANG
WHERE CATTREE.idcat=CAT.idcat AND CAT.idcat=CATLANG.idcat AND CATLANG.idlang='$lang' AND CAT.idclient='$client'
AND CATTREE.idcat=CATART.idcat AND CATART.idart=ARTLANG.idart AND CATART.is_start='1'
AND CATLANG.visible=1 AND (CATTREE.level='1' OR CATTREE.level='2')
ORDER BY CATTREE.idtree";
Code: Alles auswählen
if($db->f("redirect")=='1')
{
$tpl->set('d', 'TARGET', '_blank');
}
I'm not sure but this should work
Andreas
-
- Beiträge: 4
- Registriert: Di 9. Dez 2003, 12:59
- Kontaktdaten:
thanks.
but doesn't work out.
i checked a bit and as i know the problem is the
statement.
nothing is inserted. i tried several other attributes like title etc.
but the "a href" tag always remains the same.
only NAME and HREF are reflecting a change.
is there some class- / inc- / whatever-phpfile, where i can find the definition
what can be changed / inserted? so i can alter some files by hand.
thanks for taking trouble.
but doesn't work out.
i checked a bit and as i know the problem is the
Code: Alles auswählen
$tpl->set('d', 'TARGET', '_blank');
nothing is inserted. i tried several other attributes like title etc.
but the "a href" tag always remains the same.
only NAME and HREF are reflecting a change.
is there some class- / inc- / whatever-phpfile, where i can find the definition
what can be changed / inserted? so i can alter some files by hand.
thanks for taking trouble.
Hi,
there should be a subfolder named 'Templates' in your filesystem (e.g. if you are using the standard-client 'cms', this folder has a subfolder named 'Templates'). In this folder, there should be some files nav*_on.html resp nav*_off.html. These files are used to create the links of the navigation-module. In the <a>-tag of these files, there must be target="{TARGET}" to be able to create links that open in a new window.
I tested this Output and it seemed to work (as I have no external redirect in a starting article of a categorie I couldn't test this, but when I changed the code so that every category with a starting article that has no external redirect should open in a new window it worked):
Hope that might help
Andreas
there should be a subfolder named 'Templates' in your filesystem (e.g. if you are using the standard-client 'cms', this folder has a subfolder named 'Templates'). In this folder, there should be some files nav*_on.html resp nav*_off.html. These files are used to create the links of the navigation-module. In the <a>-tag of these files, there must be target="{TARGET}" to be able to create links that open in a new window.
I tested this Output and it seemed to work (as I have no external redirect in a starting article of a categorie I couldn't test this, but when I changed the code so that every category with a starting article that has no external redirect should open in a new window it worked):
Code: Alles auswählen
<?php
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;
}
echo '<table cellspacing="0" cellpadding="0" border="0">';
// template klasse includen
include_once($cfg["path"]["contenido"] . 'classes/class.template.php');
// template instanz
$tpl = new Template;
$sql = "SELECT CATTREE.idcat, CATTREE.level, CATLANG.name, ARTLANG.redirect
FROM ".$cfg["tab"]["cat_tree"]." AS CATTREE, ".$cfg["tab"]["cat"]." AS CAT, ".$cfg["tab"]["cat_lang"]." AS CATLANG,
".$cfg["tab"]["cat_art"]." AS CATART, ".$cfg["tab"]["art_lang"]." AS ARTLANG
WHERE CATTREE.idcat=CAT.idcat AND CAT.idcat=CATLANG.idcat AND CATLANG.idlang='$lang' AND CAT.idclient='$client'
AND CATTREE.idcat=CATART.idcat AND CATART.idart=ARTLANG.idart AND CATART.is_start='1'
AND CATLANG.visible=1 AND (CATTREE.level='1' OR CATTREE.level='2')
ORDER BY CATTREE.idtree";
$db->query($sql);
while ( $db->next_record() )
{
if ( catIsChildOf($db->f("idcat"), CMS_VALUE[0]) )
{
$tpl->reset();
$tpl->set('d', 'NAME', $db->f("name"));
if($db->f("redirect")=='1')
{
$tpl->set('d', 'TARGET', '_blank');
} $tpl->set('d', 'HREF', $sess->url('front_content.php?idcat='.$db->f("idcat").'&client='.$client.'&la'.'ng='.$lang));
$tpl->next();
switch ($db->f("level"))
{
case 1:
if ($idcat == $db->f("idcat"))
{
$tpl->generate('templates/navfirst_on.html');
} else {
$tpl->generate('templates/navfirst_off.html');
}
break;
case 2:
if ($idcat == $db->f("idcat"))
{
$tpl->generate('templates/navsecond_on.html');
} else {
$tpl->generate('templates/navsecond_off.html');
}
break;
}
}
}
echo '</table>';
?>
Andreas
-
- Beiträge: 4
- Registriert: Di 9. Dez 2003, 12:59
- Kontaktdaten: