SOLVED : Need to create a different submenu for each section of the site...how?

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.
Eskymo

Re: Need to create a different submenu for each section of the site...how?

Post by Eskymo »

I'm not using global content, I'm using

Code: Select all

{menu template='simple_navigation.tpl' start_level='2' collapse='1'}
as you suggested. I wouldn't want to put this in the header as that's not where my subnav is to appear - I want it in column1.

I did originally have global content in there as I didn't know any better and thought that might be a way to do the subnav and just put it in as a placeholder to sort out later...that error of mine was caching and causing the subnav using {menu template='simple_navigation.tpl' start_level='2' collapse='1'} not to load properly, so as clearing the cache didn't work I created a new sub page template from scratch and the subnav now works/appears OK, but it's messing up my primary nav onthe subpage as shown in the link I provided.

the global content for the header contains the following code:

Code: Select all

<div class="left"><img alt=" " src="uploads/images/assets/temp_headerleft.jpg" /></div>
<div class="right"><img alt="Techs in the City - Friendly Computer Support - 0845 621 2852" src="uploads/images/assets/logo_techsinthecity.jpg" />
{* Start Navigation *}{menu template="primary_nav"}{* End Navigation *}</div>
<div class="floatclear"></div>
Last edited by Eskymo on Tue Oct 30, 2007 9:55 pm, edited 1 time in total.
User avatar
lollipop27
Forum Members
Forum Members
Posts: 237
Joined: Wed Sep 12, 2007 4:09 pm

Re: Need to create a different submenu for each section of the site...how?

Post by lollipop27 »

nooo, sorry, i didn't say it properly

use menumanager for your first menu, because the number od levels says, that ONLY the first level is shown... so the secoin (wrong one) is disappearing,,, u understand what I mean??

Code: Select all

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<__html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">

<head>

<title>{sitename} - {title}</title>
{* The sitename is changed in Site Admin/Global settings. {title} is the name of each page *}

{metadata}
{* Don't remove this! Metadata is entered in Site Admin/Global settings. *}

{stylesheet}
{* This is how all the stylesheets attached to this template are linked to *}

</head>

</__body>
<div id="wrapper">
<div id="innerwrapper">

<div id="header">
{global_content name='header'}


[b]HERE!!!!!!
[/b]

</div>

{* Start Content *}
<div id="contentservicessub">

<div class="column1">
<img src="uploads/images/assets/subnav_services.gif" alt=" " width="162" height="53" />
{menu template='simple_navigation.tpl' start_level='2' collapse='1'}
</div>

<div class="column2">
{content block="column2 H1 Heading"}
{content block="column2 P Introduction"}
{content}
</div>

<div class="floatclearleft"></div>

</div>

<div id="footer">
{global_content name='footer'}
</div>

</div>
</div>
<div id="base"></div>
<__body>
</__html>
[/quote]
Eskymo

Re: Need to create a different submenu for each section of the site...how?

Post by Eskymo »

sorry - I was modifying my post whilst you were posting your reply. I still don;t know what you mean as I am using the menumanager for my primary nav.

I don;t want to put my subnav link in the header as that's not where it's meant to go.
User avatar
lollipop27
Forum Members
Forum Members
Posts: 237
Joined: Wed Sep 12, 2007 4:09 pm

Re: Need to create a different submenu for each section of the site...how?

Post by lollipop27 »

no, sorry, now i see the rest

Code: Select all

<div class="left"><img alt=" " src="uploads/images/assets/temp_headerleft.jpg" /></div>
<div class="right"><img alt="Techs in the City - Friendly Computer Support - 0845 621 2852" src="uploads/images/assets/logo_techsinthecity.jpg" />
{* Start Navigation *}{menu template="primary_nav" number_of_levels='1'}{* End Navigation *}</div>
<div class="floatclear"></div>
[/quote]


do it like this
Eskymo

Re: Need to create a different submenu for each section of the site...how?

Post by Eskymo »

wow - that's fixed it!

I don't really understand why though...can you explain?

I'd like to know why that works so that it can help my understanding of the CMS more.

Thanks ever so much - I can go to bed happy and un-stressed now.

- just spotted a problem though - it's fixed the problem with the button shifting down, but now when you're on a the subpage the 'services' button in the primary nav is no longer highlighted. any ideas? Sorry for bothering you again.
Last edited by Eskymo on Tue Oct 30, 2007 10:09 pm, edited 1 time in total.
User avatar
lollipop27
Forum Members
Forum Members
Posts: 237
Joined: Wed Sep 12, 2007 4:09 pm

Re: Need to create a different submenu for each section of the site...how?

Post by lollipop27 »

no problem, thats what this is for  ;)

rather sorry for my bad english, it's late....


so. the "number of levels" says that only the first leverl is generatet. Otherwise the second level (A sub page) will be displyed too... in you case underneath your parent link....

understand??

so you say: show only the first level on top


and everything from level 2 on the left...



the problem is probabely because the activeparent class is not set...
this is usually in the basic menu templates.... perhaps you deleted it by mistake by makin your template for the first navi, or did you write it yourself???

check out the default templates for activeparent or something like this....

this should be the solution, but sorry, I cant help with php....  ::)

only basic knowledge.... trying to cope myself
Last edited by lollipop27 on Tue Oct 30, 2007 10:40 pm, edited 1 time in total.
Eskymo

Re: Need to create a different submenu for each section of the site...how?

Post by Eskymo »

I don't know what I did when I create the primary nav - not sure if I deleted anything, but that's the only nav within the menu manager, so I guess I've messed things up there.

I tried importing the simple_navigation.tpl and creating a new template called subnav_menu and then went into to style things correctly, but got yet another error when I loaded the subpage...so going to leave it for tonight and look at things with a fresh head in the morning.

I'm no good with PHP either - the primary nav was written by a very helpful forum member - couldn't have got the primary nav working without him!

Thanks for the explanation - that did help with my basic understanding.
User avatar
lollipop27
Forum Members
Forum Members
Posts: 237
Joined: Wed Sep 12, 2007 4:09 pm

Re: Need to create a different submenu for each section of the site...how?

Post by lollipop27 »

Code: Select all

{elseif $node->parent == true}
<li class="activeparent"><a class="activeparent" href="{$node->url}"{if $node->accesskey != ''} accesskey="{$node->accesskey}"{/if}{if $node->tabindex != ''} tabindex="{$node->tabindex}"{/if}{if $node->titleattribute != ''} title="{$node->titleattribute}"{/if}><dfn>{$node->hierarchy}: </dfn>{$node->menutext}</a>

its this part that is missing here
Eskymo wrote: the problem is happening with the subnav occuring within the primary nav

Code: Select all

{foreach from=$nodelist item=node}
{if $node->depth > $node->prevdepth}
{repeat string="<ul>" times=$node->depth-$node->prevdepth}
{elseif $node->depth < $node->prevdepth}
{repeat string="</li></ul>" times=$node->prevdepth-$node->depth}
</li>
{elseif $node->index > 0}</li>
{/if}

{if $node->current == true}
<li id="{$node->alias}"><a href="{$node->url}" class="active" title="{$node->menutext}"> <span>{$node->menutext}</span> </a>




HERE!!!!!




{else}
<li id="{$node->alias}"><a href="{$node->url}" title="{$node->menutext}"> <span>{$node->menutext}</span></a>

{/if}

{/foreach}

{repeat string="</li></ul>" times=$node->depth-1}</li>
</ul>
{/if}
let me know if you need any moer info. Thanks for trying to help - this is doing my head in...but it is late, so that's understandable.
Eskymo

Re: Need to create a different submenu for each section of the site...how?

Post by Eskymo »

thanks - will try this in the morning - cheers!
User avatar
Dr.CSS
Moderator
Moderator
Posts: 12711
Joined: Thu Mar 09, 2006 5:32 am

Re: Need to create a different submenu for each section of the site...how?

Post by Dr.CSS »

If you make a copy of the cssmenu it has all the calls for menuactive menuparent etc... then you can trim unused parts....
Eskymo

Re: Need to create a different submenu for each section of the site...how?

Post by Eskymo »

Hi there

I pasted that code in and it's not helped...the active state of the button isn't shown, what is shown is the actual text of the link and it's not in the right place either...
http://www.techsinthecity.co.uk/devsite/index.php?page=asubpage

Mark I think I unfortunately wiped all the menu templates and just created a new primary nav, with the code you supplied.

I'm totally stuck now and the nav code just boggles me.

E
Last edited by Eskymo on Wed Oct 31, 2007 9:26 am, edited 1 time in total.
User avatar
lollipop27
Forum Members
Forum Members
Posts: 237
Joined: Wed Sep 12, 2007 4:09 pm

Re: Need to create a different submenu for each section of the site...how?

Post by lollipop27 »

Code: Select all

{foreach from=$nodelist item=node}
{if $node->depth > $node->prevdepth}
{repeat string="<ul>" times=$node->depth-$node->prevdepth}
{elseif $node->depth < $node->prevdepth}
{repeat string="</li></ul>" times=$node->prevdepth-$node->depth}
</li>
{elseif $node->index > 0}</li>
{/if}

{if $node->current == true}
<li id="{$node->alias}"><a href="{$node->url}" class="active" title="{$node->menutext}"> <span>{$node->menutext}</span> </a>


{elseif $node->parent == true}
<li d="{$node->alias}" class="activeparent"><a class="activeparent" href="{$node->url}"> <span>{$node->menutext}</span></a>




{else}
<li id="{$node->alias}"><a href="{$node->url}" title="{$node->menutext}"> <span>{$node->menutext}</span></a>

{/if}

{/foreach}

{repeat string="</li></ul>" times=$node->depth-1}</li>
</ul>
{/if}

you forgot the id, and that probabely how you style it..... try with this code
User avatar
lollipop27
Forum Members
Forum Members
Posts: 237
Joined: Wed Sep 12, 2007 4:09 pm

Re: Need to create a different submenu for each section of the site...how?

Post by lollipop27 »

hi.

just checked you css..

the id should put it on the right position, now, the span will disable the text, but you didn't style .activeparent yet....

when you want them to look like .active, then just change the class to .active instead of .activeparent in the code i gave you, or when you want them to look different, you'll have to to that via css....



good luck, it should work now
Eskymo

Re: Need to create a different submenu for each section of the site...how?

Post by Eskymo »

I was about to post and question that, I was looking at the source code of the page and noticed that the id had changed to 'class' and the class of the link had changed to activeparent and it should just be 'active'. So was trying to figure out how to get the right info in the ID and CLASS...but you've answered my query perfectly...

I just imported the simple_navigation.tpl and changed it to subnav_menu and restyled the link styles i.e. took out the H3 and it's now styled just the way I want it and the primary nave works too.

Genius!

Thanks so much for your help...I'm beginning to understand this CMS a little more each day. It's so different from doing flat HTML but I can really see the benefits of using a CMS now! I'm also less scared of tweaking bits and testing stuff and trying things out myself, but your help has been invaluable...thanks again!
Eskymo

Re: Need to create a different submenu for each section of the site...how?

Post by Eskymo »

Just one final question...

Is there are way to have the subnav include a link to the main page as the first item of the subnav list?

So if the main page, linked from the primary nav, is 'Services'

Is there a way to have my subnav be

- Services Home          //this links to the same page that the primary nav button links to
- A Subnav Link
- Another Subnav Link

or is that just going to confuse the code completely?
Locked

Return to “CMSMS Core”