Page 1 of 1

menu problems

Posted: Tue Apr 24, 2007 11:22 am
by hillick
Hi,

Im trying to use this menu, but strugling, can someone please tell me how to create this menu? where do things go to make this work?

html

Code: Select all

<div id="navwrap">
			<ul id="menu">
				<li id="active"><a href="link1">link1</a></li>
				<li><a href="link2">liink2</a></li>
				<li><a href="link3">link3</a></li>
				<li><a href="link4">link4</a></li>
				<li><a href="link5">link5</a></li>
				<li><a href="link6">link6</a></li>
			</ul>
		</div>

css

Code: Select all

#navwrap {
width:777px;
margin: auto;
height:25px;
border: 1px solid #666666;
}

ul#menu {
list-style-type:none;
width:777px;
height:25px;
font-size:14px;
line-height:1.4em;
margin:0 0 0 0px;
padding:0;
}

ul#menu li {
text-align:center;
overflow:hidden;
float:left;
}

ul#menu li a {
width:127px;
height:16px;
display:block;
color:#264b00;
text-decoration:none;
/*border-left:1px solid #FFFFFF;*/
padding:7px 0;
}

ul#menu li a:hover {
background-color:#264b00;
color:#cff3ad;
}

ul#menu li#active a {
background-color:#264b00;
color:#cff3ad;
}

if anyone can spare some time, im desperate to figure this out, any help much appreciated
if you can, could you please tell me how do i create a menu template based on this css/html and how do i call it to my page?

Re: menu problems

Posted: Tue Apr 24, 2007 12:47 pm
by Greg
In admin go to layout -> menu manager click Add Template name it MyNav put in the following code (it needs some clean up but will get you started, I will test and tweak later - have to go to work)

Code: Select all

{if $count > 0}
<div id="navwrap">
<ul id="menu">
{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->parent == true or ($node->current == true and $node->haschildren == true)}
<li class="active menuparent"><a class="active menuparent" {elseif $node->current == true}
<li class="active"><a class="active" {elseif $node->haschildren == true}
<li class="menuparent"><a class="menuparent" {else}
<li><a {/if}
href="{$node->url}"{if $node->target ne ""} target="{$node->target}"{/if}>{$node->menutext}</a>{/foreach}
{repeat string="</li></ul>" times=$node->depth-1}</li>
</ul></div>
{/if}
go to Layout -> stylesheets and add a stylesheet with your code in it call it MyNav

go to Layout -> templates and choose the template you want the menu to be in.
add the following line where you want the menu

Code: Select all

{menu template='MyNav' start_level='2' number_of_levels='1'}
go to Layout -> Templates and associate your MyNav stylesheet with the template.

Re: menu problems

Posted: Tue Apr 24, 2007 4:03 pm
by Pierre M.
Hello,
hillick wrote: Im trying to use this menu, but strugling, can someone please tell me how to create this menu? where do things go to make this work?
I don't understand : do you want to go without the automatic dynamic menu generation ?
If you want to keep the menu manager, you can copy/modify the stylesheets and menu templates.
I think there is no need to code to have a custom looking menu.
But as I do very few layout design I may have misunderstood.
Have fun
Pierre M.