Print the parent level 0 above the vertical menu

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
terael
New Member
New Member
Posts: 2
Joined: Wed Mar 06, 2013 4:09 pm

Print the parent level 0 above the vertical menu

Post by terael »

Hi,

My first level is shown in a horizontal main menu with popup submenus to go to children :
Firt entry | Second Entry | Third Entry

Then I display a vertical contextual menu. I used the "Navigation: Simple - Vertical" menu and placed the code in my template :
"{$cgsimple->get_root_alias('', 'root_alias')}
Page parent : {$cgsimple->get_page_title($root_alias)}
{menu loadprops=0 template="MRI:simple_nav_gche" start_level='2' collapse='1'}"

If I choose a child (ie child 2) in the submenu of "Second Entry", the list of the children is printed on the vertical menu. It works ! Cool !

But I would like to print the "Parent" where I came from (with its link) too:

Second Entry
> child 1
> child 2
> child 3

After several hours of research, i could'nt find the way... Please... :'(
User avatar
Dr.CSS
Moderator
Moderator
Posts: 12711
Joined: Thu Mar 09, 2006 5:32 am
Location: Arizona

Re: Print the parent level 0 above the vertical menu

Post by Dr.CSS »

Sounds like start_page='$root_alias'...
terael
New Member
New Member
Posts: 2
Joined: Wed Mar 06, 2013 4:09 pm

Re: Print the parent level 0 above the vertical menu

Post by terael »

I found sthg !
Thanks to lessire.be who has a page about its Menu Manager.

Built the "hierarchy" UDT (user defined tag)

global $gCms;
$pos = $gCms->variables['position'];
$base = explode('.', $pos);
$totalDepth = count($base);
$parentDepth = $totalDepth;
$count = 0;

foreach($base as $parentLevel) {
$parentLevel = ltrim($parentLevel, "0" );
if($count <= $parentDepth) {
$thisLevel .= $parentLevel . ".";
}
if($count < $parentDepth) {
$theParent .= $parentLevel . ".";
}
$count++;
}

$smarty->assign('h_toplevel', $base[0] * 1);
$smarty->assign('h_parent', rtrim($theParent, "." ));
$smarty->assign('h_this', rtrim($thisLevel, "." ));
clapczyn
Forum Members
Forum Members
Posts: 59
Joined: Tue Oct 27, 2009 2:00 pm

Re: Print the parent level 0 above the vertical menu

Post by clapczyn »

*EDIT*
I'm an Idiot …
solved it with menumanager and a seperate template just right after I submitted this …
sorry!
*EDIT*



Hi terael,

that UDT is almost what I am looking for.
I've got a horizontal top menu (with dropdown) and in addition a vertical submenu (same as dropdown). Since I am using babel for multilingual content I've got 3 levels of pages like this:

1 Deutsch
1.1 Leistungsangebot
1.1.1 Financial Advisory
1.1.2 Rating Advisory
...

2 English
2.1 Range of services
2.1.1 Financial Advisory
2.1.2 Rating Advisory
...

Horizontal Menu call:

Code: Select all

{menu start_level="2" number_of_levels="2"}
Vertical submenu for a selected menupoint:

Code: Select all

{menu start_level="3" template="submenu"}
I now want the parent (level 2) of the selected submenupoint (level 3) to be shown as a headline in the vertical sidebar:

Code: Select all

<h1>Level 2 (Parent) Title</h1>
{menu start_level="3" template="submenu"}
Problem is that some level 2 elements have content, some are just internal sitelinks.

Your UDT returns the top-level value (1 or 2 for Deutsch or English) in h_toplevel
But unfortunately it always returns the same value for h_parent and h_this (the current page)

So when level 2 has content it returns for example 1.2 for both
If it is just a sitelink that calls the first child it returns the childs hierarchical position (for example: 1.2.1)

Maybe this is the wrong place for my question or maybe there is another better solution but this was the closest solution I could find in the forum … if so, sorry!

I hope that I've explained my problem good enough – any help is highly appreciated!

Thx in advance!

*EDIT*
I'm an Idiot …
solved it with menumanager and a seperate template just right after I submitted this …
sorry!
*EDIT*
staartmees
Power Poster
Power Poster
Posts: 1049
Joined: Wed Mar 19, 2008 4:54 pm

Re: Print the parent level 0 above the vertical menu

Post by staartmees »

Please add [solved] to the title
Locked

Return to “CMSMS Core”