How to show the menu as fully expanded

General questions about CMSimple
Post Reply
sonnur
Posts: 24
Joined: Sat Dec 29, 2012 6:54 pm

How to show the menu as fully expanded

Post by sonnur » Wed Aug 07, 2013 1:24 pm

I am creating a CMSimple theme that have a dropdown menu.

How do I show the menu as fully expanded with all menu levels open?

Gert
Posts: 3078
Joined: Fri May 30, 2008 4:53 pm
Location: Berlin
Contact:

Re: How to show the menu as fully expanded

Post by Gert » Wed Aug 07, 2013 1:35 pm

Hello,

which CMSimple you are using?

In CMSimple 4.1.3 and higher you can set in the template.htm:

Code: Select all

<?php echo toc(1,3,1);?>
The first 2 parameters are the minimal and the maximal menulevel.

The third parameter:

0 - dynamic Menu
1 - expanded menu

So the code example shows menulevel 1-3 in an expanded menu,

Gert

PS: An "automatic" open toc:

Code: Select all

<?php echo toc(1,$cf['menu']['levels'],1);?>
Menulevels as configured in the CMS Configuration.
Gert Ebersbach | CMSimple | Templates - Plugins - Services

cmb
Posts: 14225
Joined: Tue Jun 21, 2011 11:04 am
Location: Bingen, RLP, DE
Contact:

Re: How to show the menu as fully expanded

Post by cmb » Wed Aug 07, 2013 2:00 pm

sonnur wrote:How do I show the menu as fully expanded with all menu levels open?
Instead of

Code: Select all

<?php echo toc();?>
you can write

Code: Select all

<?php echo li($hc, 'menulevel');?>
(that should work in nearly all CMSimple versions).

Both this and Gert's solution have a small drawback, however. The currently selected page is not marked up as <a>, so you would have to use li:hover instead of a:hover, what does not work on IE 6 for instance.

However, you can use xtoc as a drop in replacement for toc().
Gert wrote:In CMSimple 4.1.3 and higher you can set in the template.htm:

Code: Select all

<?php echo toc(1,3,1);?>
That goes terribly wrong with CMSimple_XH since 1.5.4--what a pity to enforce an incompatibility for having a feature that's "always" been there.
Gert wrote:An "automatic" open toc:

Code: Select all

<?php echo toc(null, null, 1);?>
Christoph M. Becker – Plugins for CMSimple_XH

sonnur
Posts: 24
Joined: Sat Dec 29, 2012 6:54 pm

Re: How to show the menu as fully expanded

Post by sonnur » Wed Aug 07, 2013 4:42 pm

Thanks for answers I did use:

Code: Select all

<?=li($hc,'sitemaplevel')?>

cmb
Posts: 14225
Joined: Tue Jun 21, 2011 11:04 am
Location: Bingen, RLP, DE
Contact:

Re: How to show the menu as fully expanded

Post by cmb » Wed Aug 07, 2013 6:51 pm

'sitemaplevel' is rather unconventional in this context, but it's okay if it works for you.
Christoph M. Becker – Plugins for CMSimple_XH

cmb
Posts: 14225
Joined: Tue Jun 21, 2011 11:04 am
Location: Bingen, RLP, DE
Contact:

Re: How to show the menu as fully expanded

Post by cmb » Fri Aug 09, 2013 10:56 am

cmb wrote:
Gert wrote:In CMSimple 4.1.3 and higher you can set in the template.htm:

Code: Select all

<?php echo toc(1,3,1);?>
That goes terribly wrong with CMSimple_XH since 1.5.4--what a pity to enforce an incompatibility for having a feature that's "always" been there.
I've seen that this has changed in CMSimple 4.2.3, where the third parameter of toc() was removed, and instead there's a new function expToc() that can be used as replacement for toc(). Thanks, Gert.
Christoph M. Becker – Plugins for CMSimple_XH

Gert
Posts: 3078
Joined: Fri May 30, 2008 4:53 pm
Location: Berlin
Contact:

Re: How to show the menu as fully expanded

Post by Gert » Fri Aug 09, 2013 1:10 pm

cmb wrote:I've seen that this has changed in CMSimple 4.2.3, where the third parameter of toc() was removed, ...
No, it's not removed :!: - expToc() is just added.

Calls like toc(2,3,1) are a nice tool to set different tocs anywhere in the template, menulevels as wanted, dynamically or expanded, as ever someone wants. I will not remove this option,

Gert
Gert Ebersbach | CMSimple | Templates - Plugins - Services

cmb
Posts: 14225
Joined: Tue Jun 21, 2011 11:04 am
Location: Bingen, RLP, DE
Contact:

Re: How to show the menu as fully expanded

Post by cmb » Fri Aug 09, 2013 3:19 pm

Gert wrote:No, it's not removed :!: - expToc() is just added.
Thanks for the clarification.
Gert wrote:Calls like toc(2,3,1) are a nice tool to set different tocs anywhere in the template, menulevels as wanted, dynamically or expanded, as ever someone wants.
I see your point now. But then, being able to specify a user (or template designer) defined li() seems to also be a nice tool. However, as it is now, a template designer who wants his templates to work under CMSimple v4 as well as CMSimple_XH can't use either tool. So we may consider to find a common solution.
Christoph M. Becker – Plugins for CMSimple_XH

Post Reply