Menu styling? Easy answer for s1 who knows what he does!

For discussion and questions related to CMS Specific templates and stylesheets (CSS), and themes. or layout issues. This is not a place for generic "I don't know CSS issues"
Post Reply
rtkd
Forum Members
Forum Members
Posts: 126
Joined: Tue Dec 12, 2006 3:57 pm

Menu styling? Easy answer for s1 who knows what he does!

Post by rtkd »

Hi,

i'm trying to restyle the menu.
It almost works like a charm, but the code it creates is missing just one div.
I've tried a lot but somehow i just dont get it...

here is the code it produces

Code: Select all

<div>
	<div class="parent">
		<a href="">1</a>
		<div>
			<div class="current"><a href="">1.1</a></div>
			<div class="else"><a href="">1.2</a></div>
			<div class="else"><a href="">1.3</a></div>
			<div class="else"><a href="">1.4</a></div>
		</div>
	</div>
	<div class="link"><a href="">2</a></div>
	<div class="link"><a href="">3</a></div>
	<div class="link"><a href="">4</a></div>
</div>
and this is how i should look

Code: Select all

<div>
	<div class="parent"><a href="">1</a></div>
	<div>
		<div class="current"><a href="">1.1</a></div>
		<div class="else"><a href="">1.2</a></div>
		<div class="else"><a href="">1.3</a></div>
		<div class="else"><a href="">1.4</a></div>
	</div>
	<div class="link"><a href="">2</a></div>
	<div class="link"><a href="">3</a></div>
	<div class="link"><a href="">4</a></div>
</div>
and here the tmpl. code

Code: Select all

{if $count > 0}
	<div>
	{foreach from=$nodelist item=node}
		{if $node->depth > $node->prevdepth}
			{repeat string="<div>" times=$node->depth-$node->prevdepth}
		{elseif $node->depth < $node->prevdepth}
			{repeat string="</div></div>" times=$node->prevdepth-$node->depth}
			</div>
		{elseif $node->index > 0}
			</div>
		{/if}
		{if $node->parent == true or ($node->current == true and $node->haschildren == true)}
			<div class="parent"><div><a 
		{elseif $node->current == true}
			<div class="current"><a 
		{elseif $node->type == 'link'}
			<div class="link"><a 
		{elseif $node->haschildren == true}
			<div class="hasChildren"><a 
		{else}
			<div class="else"><a 
		{/if}
		{if $node->type != 'separator'}
			href="{$node->url}">{$node->menutext}
			</a>
		{/if}
	{/foreach}
	{repeat string="</div></div>" times=$node->depth-1}
	</div>
	</div>
{/if}
thank u for help, rtkd!
Last edited by rtkd on Tue Dec 12, 2006 4:24 pm, edited 1 time in total.
User avatar
Dr.CSS
Moderator
Moderator
Posts: 12711
Joined: Thu Mar 09, 2006 5:32 am

Re: Menu styling? Easy answer for s1 who knows what he does!

Post by Dr.CSS »

Try adding one at the end here, you may have to take out one of the others... I also add 1, 2, 3, in the menu template to see where it may need something... They may not show on the page so look in the source...

{if $node->type != 'separator'}
href="{$node->url}">{$node->menutext}
rtkd
Forum Members
Forum Members
Posts: 126
Joined: Tue Dec 12, 2006 3:57 pm

Re: Menu styling? Easy answer for s1 who knows what he does!

Post by rtkd »

hi,

thank u for ur quick answer, but i somehow still don't get it...
i think i just don't understand the syntax of the .tpl file.

i need a div around the parent link of of the active section, i commented in the code.

Code: Select all

<div>
	<div class="parent">
		/*
		@ I need DIV class="link" around the "Parent Link"
		@ so i can give class="link" a bg-pic with css
		*/
		<div class="link"><a href="">1</a></div>
		/*
		@
		*/
		<div>
			<div class="current"><a href="">1.1</a></div>
			<div class="else"><a href="">1.2</a></div>
			<div class="else"><a href="">1.3</a></div>
			<div class="else"><a href="">1.4</a></div>
		</div>
	</div>
	<div class="link"><a href="">2</a></div>
	<div class="link"><a href="">3</a></div>
	<div class="link"><a href="">4</a></div>
</div>
thank you for ur help, i really appreciate it!
Last edited by rtkd on Wed Dec 13, 2006 10:46 am, edited 1 time in total.
User avatar
Dr.CSS
Moderator
Moderator
Posts: 12711
Joined: Thu Mar 09, 2006 5:32 am

Re: Menu styling? Easy answer for s1 who knows what he does!

Post by Dr.CSS »

Try this... forgot to take out the numbers, that's how I found the offending div calls... just delete them


{if $count > 0}

{foreach from=$nodelist item=node}
{if $node->depth > $node->prevdepth}
{repeat string="" times=$node->depth-$node->prevdepth}
{elseif $node->depth prevdepth}
{repeat string="8" times=$node->prevdepth-$node->depth}

{elseif $node->index > 0}
6
{/if}
{if $node->parent == true or ($node->current == true and $node->haschildren == true)}
current == true}
type == 'link'}
haschildren == true}
type != 'separator'}
href="{$node->url}">{$node->menutext}

{/if}
{/foreach}
{repeat string="3" times=$node->depth-1}

{/if}
rtkd
Forum Members
Forum Members
Posts: 126
Joined: Tue Dec 12, 2006 3:57 pm

Re: Menu styling? Easy answer for s1 who knows what he does!

Post by rtkd »

hi mark,

its just missing one closing div somewhere, i hope i'll find it myself.
otherwise works fine.

thank you a million times! rtkd
rtkd
Forum Members
Forum Members
Posts: 126
Joined: Tue Dec 12, 2006 3:57 pm

Re: Menu styling? Easy answer for s1 who knows what he does!

Post by rtkd »

nope. cant find it myself :(

if i put another into {repeat string="3" times=$node->depth-1}
it works fine untill i click the last element in the navigation, then again tidy tells me its missing a closing div.
User avatar
Dr.CSS
Moderator
Moderator
Posts: 12711
Joined: Thu Mar 09, 2006 5:32 am

Re: Menu styling? Easy answer for s1 who knows what he does!

Post by Dr.CSS »

rtkd
Forum Members
Forum Members
Posts: 126
Joined: Tue Dec 12, 2006 3:57 pm

Re: Menu styling? Easy answer for s1 who knows what he does!

Post by rtkd »

not yet. i'lll put it online first thing tomorrow!
rtkd
Forum Members
Forum Members
Posts: 126
Joined: Tue Dec 12, 2006 3:57 pm

Re: Menu styling? Easy answer for s1 who knows what he does!

Post by rtkd »

http://web35.clickpress.info/

pls, don't be mad at me for using tables in the template :)
but that layout was just too difficult to realize with divs.

i took out the whole nav, to see if the missing div still occures, and it didnt,
so i figured it must be in the nav menu code
User avatar
Dr.CSS
Moderator
Moderator
Posts: 12711
Joined: Thu Mar 09, 2006 5:32 am

Re: Menu styling? Easy answer for s1 who knows what he does!

Post by Dr.CSS »

Why are you using div on the menu I thought you were doing something along the lines of this...

http://www.multiintech.com/cmsms2/&nbsp; or...

http://www.multiintech.com/cmsms2/index.php/golf.html
rtkd
Forum Members
Forum Members
Posts: 126
Joined: Tue Dec 12, 2006 3:57 pm

Re: Menu styling? Easy answer for s1 who knows what he does!

Post by rtkd »

oh, i just took the cssmenu and stripped it of everything i thought i would not need.
as said im not really familiar with the template language.
User avatar
Dr.CSS
Moderator
Moderator
Posts: 12711
Joined: Thu Mar 09, 2006 5:32 am

Re: Menu styling? Easy answer for s1 who knows what he does!

Post by Dr.CSS »

Start with the default cssmenu template and copy the Vert. Nav CSS Menu style sheet, go to Layout > Style Sheets to the right is an icon, looks like 2 sheets of paper, click, rename, submit, use this with your template...

If you use Firefox with the Web Developer toolbar you can edit the CSS in real time, not the real one it just works on the side so you can play/tweak till you like it, then when you get it right copy the part you changed and paste it into the real CSS...

You will need the default Tools CSS to get rid of the numbers in the menu...
Post Reply

Return to “Layout and Design (CSS & HTML)”