Page 1 of 1
[solved]content navigation--need to display ORIGINAL parent item at all times
Posted: Thu Sep 06, 2007 1:32 pm
by streever
Hi all,
my site is organized into sections, and each section has a sub-nav.
See:
http://www.whps.org/cms/index.php?page=primary-offices
Now, what I want is for the FIRST large item to be the PARENT section. In this case OFFICES. I want it to stay as Offices as the user navigates through the sub-items.
I want the menu to always display the 2nd level of navigation (the sub-items) and the parent at the top, as the big title. I want the THIRD level to display beneath it's parent.
Now, I'm very proficient in CSS. I will be hiding/showing the third level of nav in the CSS. That's no problem. The problem is the TOP most--the title--can anyone help me in displaying that? What is the template call to always display the FIRST parent?
P.S.
I am familiar with the UDT that calguy wrote, but I don't know how to use it.... maybe that would help me? Link:
http://forum.cmsmadesimple.org/index.ph ... 405.0.html
Re: content navigation--need to display ORIGINAL parent item at all times
Posted: Thu Sep 06, 2007 2:12 pm
by calguy1000
it'd be something like this, I think:
{get_root_alias alias=$page_alias assign='parent'}{menu start_page=$parent}
Re: content navigation--need to display ORIGINAL parent item at all times
Posted: Thu Sep 06, 2007 2:24 pm
by streever
So I can just drop that info in my code?
I also want the GRANDPARENT page to have a unique class--like "pagetitle"--so I am guessing that would have to go in the MenuManager but don't know how to do it.
The best solution for me would be if I had my template:
YOUR SNIPPET
{menu}
This is ideally how I want my template to look-iis that possible?
Thanks so much--
Re: content navigation--need to display ORIGINAL parent item at all times
Posted: Thu Sep 06, 2007 2:46 pm
by calguy1000
Yes, you can drop that into your code
the first thing to do is to use this code, and the differrent parameters of the menu manager template to make sure that the output contains information for the correct nodes.
Then you can worry about editing the menumanager template if needed to adjust the classes, and styles, etc.
Re: content navigation--need to display ORIGINAL parent item at all times
Posted: Thu Sep 06, 2007 2:51 pm
by streever
Hey Calguy,
OK, I'm going to give it a try! I am worried it won't work because I don't know how to pull out the START element in the Menu Template--do you know what I mean? But i am going to be brave and try it.
Thank you!
Re: content navigation--need to display ORIGINAL parent item at all times
Posted: Thu Sep 06, 2007 3:35 pm
by streever
OK, this DOES work!
But I don't know how to style the titles.
Does anyone have a suggestion for how to call them out in the template, the menu manager template? Like, "IF X THEN Y" type of stuff.... I'd like to just assign a class/id to them. The problem is, that I don't know how to do this in the menu manager templates....
Re: content navigation--need to display ORIGINAL parent item at all times
Posted: Thu Sep 06, 2007 3:38 pm
by calguy1000
styling is not my forte

Re: content navigation--need to display ORIGINAL parent item at all times
Posted: Thu Sep 06, 2007 3:43 pm
by streever
do you know how to call out that one element though?
so say,
IF PARENTID THEN
ELSEIF
do you know what I mean? ordinarily I'd rely on "menuparent" but that will be whatever button they click next--one of the sub-nav items--because this menu has 3 levels! so I can't use the standard menuparent because several li tags will be menuparents. i need to address "grandparent"....
Re: content navigation--need to display ORIGINAL parent item at all times
Posted: Thu Sep 06, 2007 4:37 pm
by streever
{if $node->parentID == true}alias}" class="menuGrandParent"><a class="menuGrandParent"
this is what I tried, but it didn't work. I'm not sure what to put in place of parentID--the user defined tag is below. That shows how CMSMS knows to put in the grandparent, so to speak.
Code: Select all
/* Get the alias of the top level parent
Takes a page alias as input
outputs a page alias, or an empty string if the alias input is a top level
*/
if( !isset($params['alias']) ) return;
global $gCms;
$contentops =& $gCms->GetContentOperations();
$alias = '';
$id = $contentops->GetPageIDFromAlias( $params['alias'] );
while( $id != -1 )
{
$content =& $contentops->LoadContentFromId( $id );
if( is_object( $content ) ) {
$alias = $content->Alias();
$id = $content->ParentId();
}
}
if( isset($params['assign']) )
{
$smarty =& $gCms->GetSmarty();
$smarty->assign( $params['assign'], $alias );
return;
}
else
{
return $alias;
}
Re: content navigation--need to display ORIGINAL parent item at all times
Posted: Thu Sep 06, 2007 4:54 pm
by calguy1000
try {if $node->index == 0} in a menu manager template.
Re: content navigation--need to display ORIGINAL parent item at all times
Posted: Thu Sep 06, 2007 5:03 pm
by streever
YOU MAKE IT LOOK SO EASY!!! That is exactly what I needed.
merci beaucoup, gracious, domo arigato, merci mille fois, etc etc.... you are a life saver yet again.
Re: content navigation--need to display ORIGINAL parent item at all times
Posted: Thu Sep 06, 2007 5:41 pm
by calguy1000
You mean it's not easy?

Re: [solved]content navigation--need to display ORIGINAL parent item at all times
Posted: Thu Sep 06, 2007 7:02 pm
by streever
OK, so it is, but in my caffeine addled, stress-induced mind it becomes something big and difficult
