two seperate menues
two seperate menues
Hi
I have two seperate menues, a main navigation (vertical) and a meta navigation (horizontal).
While one menue is active, the other one should show the 1st level entries.
Is there a way to achieve this?
regards
manu
I have two seperate menues, a main navigation (vertical) and a meta navigation (horizontal).
While one menue is active, the other one should show the 1st level entries.
Is there a way to achieve this?
regards
manu
Re: two seperate menues
Hi manu,
to do so serverside, the server would have to be informed, which menu is active by modifying the links approriately in li(). E.g. something like:
Then in the template this parameter has to be checked and acted accordingly:
Christoph
to do so serverside, the server would have to be informed, which menu is active by modifying the links approriately in li(). E.g. something like:
Code: Select all
<a href="./?Welcome&menu=1" ...>Welcome</a>
Code: Select all
<?php echo !isset($_GET['menu']) || $_GET['menu'] == 1 ? toc() : toc(1,1);?>
<?php echo !isset($_GET['menu']) || $_GET['menu'] == 2 ? toc() : toc(1,1);?>
Christoph M. Becker – Plugins for CMSimple_XH
Re: two seperate menues
Thx Christoph,
for this fix I could read the appropriate menu from $su; but still, the wrong section would be displayed in the inactive menu.
I probably have to (use xtoc(),) render complete both the two menues and hide the "wrong" parts with style definition.
regards
manu
for this fix I could read the appropriate menu from $su;
Code: Select all
<?php echo preg_match('/^menu1/',$su) ? toc(2,4) : toc(2,2);?>
I probably have to (use xtoc(),) render complete both the two menues and hide the "wrong" parts with style definition.
regards
manu
Re: two seperate menues
Hi manu,
I'm still wondering, what exactly you're trying to accomplish. From the code you've posted, it seems that some page headings start with "menu1" and that one of the menus only should show second level (and down) headings.
Normally one can have the following two menus: which works fine.
Christoph
I'm still wondering, what exactly you're trying to accomplish. From the code you've posted, it seems that some page headings start with "menu1" and that one of the menus only should show second level (and down) headings.
Normally one can have the following two menus:
Code: Select all
<?php echo toc(1,1);?>
<?php echo toc(2,3);?>
To have the full menu you can access $hc/$hl (cms.php line~301ff) and render it with li($hc, $startLevel).manu wrote:I probably have to (use xtoc(),) render complete both the two menues and hide the "wrong" parts with style definition.
Christoph
Christoph M. Becker – Plugins for CMSimple_XH
Re: two seperate menues
A common task is to have two navigations, one main navigation and a seperate meta navigation ("about us, impressum, contact, etc.).
My intention is to put the main navigation vertical and the meta navigation somewhere horizontal, like here.
My idea is to group the content as follows:
- mainnavi
--item1
--item2
--item3
-metanavi
--about us
--contact
--impressum
My intention is to put the main navigation vertical and the meta navigation somewhere horizontal, like here.
My idea is to group the content as follows:
- mainnavi
--item1
--item2
--item3
-metanavi
--about us
--contact
--impressum
Re: two seperate menues
Hi Manu,
the simpliest way is, to hide impressum, contact & Co. and make a handmade navigation in a newsbox, that's easy to do with the internal links function of the editor dialog,
Gert
the simpliest way is, to hide impressum, contact & Co. and make a handmade navigation in a newsbox, that's easy to do with the internal links function of the editor dialog,
Gert
Last edited by Gert on Fri Feb 01, 2013 10:25 am, edited 1 time in total.
Re: two seperate menues
Hi manu, hi Gert,
Assuming that the number of these "meta" pages is fixed, and they're all put as last <h1> pages, there's another simple solution. Make two copies of li(), say liMeta() and liNormal() and change $ta at the beginning of them:
Then you can call in the template:
Christoph
PS: in this case the pages must not be hidden.
PPS: this solution requires CMSimple_XH 1.5.4 or above.
PPPS: even better don't make copies of li(), but instead just define the following:
Ah, now I understand!manu wrote:My intention is to put the main navigation vertical and the meta navigation somewhere horizontal, like here.
Yes, that's right. But it has a drawback: the currently selected page isn't "highlighted" in the menu.Gert wrote:the simpliest way is, to hide impressum, contact & Co. and make a handmade navigation in a newsbox, that's easy to do with the internal links function of the editor dialog,
Assuming that the number of these "meta" pages is fixed, and they're all put as last <h1> pages, there's another simple solution. Make two copies of li(), say liMeta() and liNormal() and change $ta at the beginning of them:
Code: Select all
function liMeta($ta, $st) {
global $s, $l, $h, $cl, $cf, $u;
$ta = array_slice($ta, -3); // use only the last three pages
...
}
function liNormal($ta, $st) {
global $s, $l, $h, $cl, $cf, $u;
$ta = array_slice($ta, 0, -3); // use all but the last three pages
...
}
Code: Select all
<?php echo toc(1, 1, 'liMeta');?>
<?php echo toc(null, null, 'liNormal');?>
PS: in this case the pages must not be hidden.
PPS: this solution requires CMSimple_XH 1.5.4 or above.
PPPS: even better don't make copies of li(), but instead just define the following:
Code: Select all
function liMeta($ta, $st) {
$ta = array_slice($ta, -3);
return li($ta, $st);
}
function liNormal($ta, $st) {
$ta = array_slice($ta, 0, -3);
return li($ta, $st);
}
Last edited by cmb on Thu Jan 31, 2013 3:07 pm, edited 4 times in total.
Reason: added PS and PPS and PPPS
Reason: added PS and PPS and PPPS
Christoph M. Becker – Plugins for CMSimple_XH
Re: two seperate menues
Then you can call in the template:
Nice move. But as you said, this works only with no subpages in the metanav.
My next approach is still to render both navis complete and fade out the "wrong" elements by either css/xtoc or jquery.
Code: Select all
<?php echo toc(1, 1, 'liMeta');?>
<?php echo toc(null, null, 'liNormal');?>
My next approach is still to render both navis complete and fade out the "wrong" elements by either css/xtoc or jquery.
Re: two seperate menues
Well, actually it will work with subpages in the meta navigation (toc(null, null, 'liMeta'). Only the number of the meta pages has to be fix. And even this can be circumvented by dividing the normal pages from the meta pages by having a fixed "boundary". E.g. if the first meta page's heading is "About us", one can use:
Code: Select all
function liMeta($ta, $st) {
global $cl, $h;
$i = $cl - array_search('About us', $h);
$ta = array_slice($ta, -$i);
return li($ta, $st);
}
function liNormal($ta, $st) {
global $cl, $h;
$i = $cl - array_search('About us', $h);
$ta = array_slice($ta, 0, -$i);
return li($ta, $st);
}
Christoph M. Becker – Plugins for CMSimple_XH
Re: two seperate menues
Ok Christoph, this is one approach, and its pretty brilliant.
I just did a test with jquery.
I have two fully rendered menues, wrapped in either a #main and a #meta div.
The jquery looks like:which fades out the unwanted part.
For a possible noscript fallback I fade out the meta navi completely by css, which will be included in the main navi in this particular case. A possible drawback is the double toc() call. Therefore I assign the toc() to a variable:
This should do it. But the Christoph's one above is best.
I just did a test with jquery.
I have two fully rendered menues, wrapped in either a #main and a #meta div.
The jquery looks like:
Code: Select all
$(document).ready(function(){
$("#main ul.menulevel1 li").slice(-3).hide();
$("#meta ul).show();
$("#meta ul.menulevel1 li").slice(0,-3).hide();
});
For a possible noscript fallback I fade out the meta navi completely by css, which will be included in the main navi in this particular case. A possible drawback is the double toc() call. Therefore I assign the toc() to a variable:
Code: Select all
<div id="main">
<?php echo $navi_cnt = toc();?>
</div>
<div id="meta">
metanav:
<?php echo $navi_cnt;?>
</div>