Menu manipulation - is it possible?

For questions and problems with the CMS core. This board is NOT for any 3rd party modules, addons, PHP scripts or anything NOT distributed with the CMS made simple package itself.
Locked
pishkus

Menu manipulation - is it possible?

Post by pishkus »

Hi.

My site has 3 levels deep, e.g.

Level1
  - Level2.1
  - Level2.2
    -- Level3.1
    -- Level3.2
    -- Level3.3
  - Level2.3

Is it possible to make a menu, which would work like this:
When i'm in a page of Level2 and it has child elements  (e.g. Level2.2) - menu would list only child elements (i.e. Level3.1 Level3.2 Level3.3). And if the Level2 page has no child elements, it would show its "brothers" i.e. all Level2 elements.

So, i would glad to hear about any solution, dirty or not, it doesn't matter :)

Thanks!
User avatar
chead
Forum Members
Forum Members
Posts: 63
Joined: Tue Feb 06, 2007 4:01 am

Re: Menu manipulation - is it possible?

Post by chead »

If you mean the menu would look like this, where ALL CAPS and === represent the current page you are on...


LEVEL1===
  - Level2.1
  - Level2.2
  - Level2.3




Level1
  - LEVEL2.1===
  - Level2.2
  - Level2.3



Level1
  - Level2.1
  - LEVEL2.2===
    -- Level3.1
    -- Level3.2
    -- Level3.3
  - Level2.3






... then you can do this with the collapse="1" parameter. If that's not what you meant, can you clarify?
cyberman

Re: Menu manipulation - is it possible?

Post by cyberman »

pishkus wrote: When i'm in a page of Level2 and it has child elements  (e.g. Level2.2) - menu would list only child elements (i.e. Level3.1 Level3.2 Level3.3). And if the Level2 page has no child elements, it would show its "brothers" i.e. all Level2 elements.
And where should level 1 be shown?

Think Smarty can do it for you. Please look here

http://wiki.cmsmadesimple.org/index.php ... t_children

There you will found a solution for counting childrens. So it could be done with some if ... else stuff.
pishkus

Re: Menu manipulation - is it possible?

Post by pishkus »

In my page layout, there is a css-dropdown menu at the top of the page, which shows only first and second layer. But the first layer is not clickable, i.e. section headers, so only level2 is usable.
At the right side of the page, there is a column named "find out more", which is used to display level3 pages. But when level2 page has no children, the column is empty and is useless, so the idea is to show ONLY level2 if no level3 items are present, and ONLY level3 if there are level3 items.
Vin

Re: Menu manipulation - is it possible?

Post by Vin »

I can't write an entire template for you right now, but I think the menu template for the right column would have to consist of some {if} statements and
$node->haschildren,
$node->depth

OMG... looks like this piece of advice is really helpful... sorry.
cyberman

Re: Menu manipulation - is it possible?

Post by cyberman »

pishkus wrote: the column is empty and is useless,
Empty values are also good values  ;). You can use it as trigger in smarty like

Code: Select all

{if $num_children eq ''}
or

Code: Select all

{if $num_children = 0}
Locked

Return to “CMSMS Core”