CMS Made Simple Forums

Insert ID for horizontal drop line menu
Page 1 of 1

Author:  ngoncom [ Wed Jul 07, 2010 3:37 am ]
Post subject:  Insert ID for horizontal drop line menu

Dear masters!

I want to have a horizontal drop line menu and I want align it base on parent menu, here is structure:

So, I'd like insert ID for
    when menu has submenu to align it by css, can it possible?.

    Thank masters!

Author:  Dr.CSS [ Wed Jul 07, 2010 9:14 am ]
Post subject:  Re: Insert ID for horizontal drop line menu

First off ID or class can't use numbers, you will need a letter in front of it...

You will need to import a menu template and customize it, first thing I would do is put numbers after or before every
    call in it to find which one to target then you can use the {counter} function to count the steps/amount of times it's cycled thru the

Author:  kermit [ Wed Jul 07, 2010 10:49 am ]
Post subject:  Re: Insert ID for horizontal drop line menu

Yup, IDs cannot start with a number... they should also be unique on a page. So, you need to use classes instead of IDs or use two "prefixes", one for the UL submenus, the other for the actual menu items.. example below, based on minimal_menu.tpl, uses the latter.

entire menu is <ul id="menu">
nested submenus are <ul id="menu_N"> where N equals hierarchy position of parent
menu items are <a id="position_N"> where N equals hierarchy position
(where menu item is not a link, the <li> is assigned the id instead)
dashes replace dots, e.g. <a id="position_2-1-3">

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

{assign var='prevlevel' value=$node->hierarchy|replace:'.':'-'}

{if $node->current == true}
<li><a href="{$node->url}" id="position_{$node->hierarchy|replace:'.':'-'}" class="currentpage"{if $node->target ne ""} target="{$node->target}"{/if}> {$node->menutext} </a>

{elseif $node->parent == true && $node->depth == 1 and $node->type != 'sectionheader' and $node->type != 'separator'}
<li class="activeparent"> <a href="{$node->url}" id="position_{$node->hierarchy|replace:'.':'-'}" class="activeparent"{if $node->target ne ""} target="{$node->target}"{/if}> {$node->menutext} </a>

{elseif $node->type == 'sectionheader'}
<li class="sectionheader" id="position_{$node->hierarchy|replace:'.':'-'}">{$node->menutext}

{elseif $node->type == 'separator'}
<li style="list-style-type: none;" id="position_{$node->hierarchy|replace:'.':'-'}"> <hr class="separator" />

<li><a href="{$node->url}" id="position_{$node->hierarchy|replace:'.':'-'}"{if $node->target ne ""} target="{$node->target}"{/if}> {$node->menutext} </a>



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

Author:  ngoncom [ Thu Jul 08, 2010 3:21 am ]
Post subject:  Re: Insert ID for horizontal drop line menu

My sincerely thank Admin and Kermit very much!

Now, I can do it myself  :D

Page 1 of 1 All times are UTC
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group