Menu problem with different colored / styled divs

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
dapam
Forum Members
Forum Members
Posts: 14
Joined: Tue Oct 28, 2008 5:28 am

Menu problem with different colored / styled divs

Post by dapam »

I'm trying to build menu like this:

Code: Select all

    <div class="menu_green">
	     <ul>
		   <li><a href="#">Parent1</a>
		     <ul>
		       <li><a href="#">Child1</a></li>
		       <li><a href="#">Child2</a></li>
		       <li><a href="#">Child3</a></li>
		       <li><a href="#">Child4</a></li>
			 </ul>
		   </li>
		 </ul>
       </div>

       <div class="menu_lblue_inactive">
	     <ul>
		   <li><a href="#">Parent2</a>
		     <ul>
		       <li><a href="#">Child1</a></li>
		       <li><a href="#">Child2</a></li>
		       <li><a href="#">Child3</a></li>
		       <li><a href="#">Child4</a></li>
			 </ul>
		   </li>
		 </ul>
       </div>

       <div class="menu_orange_inactive">
	     <ul>
		   <li><a href="#">Parent3</a>
		     <ul>
		       <li><a href="#">Child1</a></li>
		       <li><a href="#">Child2</a></li>
		       <li><a href="#">Child3</a></li>
		       <li><a href="#">Child4</a></li>
			 </ul>
		   </li>
		 </ul>
       </div>

       <div class="menu_dblue_inactive">
	     <ul>
		   <li><a href="#">Parent4</a>
		     <ul>
		       <li><a href="#">Child1</a></li>
		       <li><a href="#">Child2</a></li>
		       <li><a href="#">Child3</a></li>
		       <li><a href="#">Child4</a></li>
			 </ul>
		   </li>
		 </ul>
       </div>
This might need four different menus like menu_green, menu_lblue, menu_orange and menu_dblue. This is the code I've started with:

Code: Select all

{if $count > 0}
  {foreach from=$nodelist item=node}
     {if $node->alias == 'green'}
      <div class="menu_green">
     {/if}
    {if $node->alias == 'lblue'}
      <div class="menu_lblue_inactive">
     {/if}
    {if $node->alias == 'orange'}
      <div class="menu_orange_inactive">
     {/if}
    {if $node->alias == 'dblue'}
      <div class="menu_dblue_inactive">
     {/if}
  {/foreach}
{/if}
So with menu_green, other are inactive and so on. But I really don't know how to continue from this. If someone could give a little hint, I would be really happy.
Last edited by dapam on Tue Oct 19, 2010 3:38 pm, edited 1 time in total.
User avatar
Dr.CSS
Moderator
Moderator
Posts: 12711
Joined: Thu Mar 09, 2006 5:32 am

Re: Menu problem with different colored / styled divs

Post by Dr.CSS »

You may find it easier to change one of the existing menu templates and use the extra key in the page or the root page alias to control the CSS...

You could look at the code used here, under products, for an example...

http://blueoakom.com/index.php
Post Reply

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