MenuManager - cssmenu-accessible.tpl - menuparent with children but no link

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"
Locked
larskong

MenuManager - cssmenu-accessible.tpl - menuparent with children but no link

Post by larskong »

Hi CMSMS forum,

Thank you for a great CMS. I love to work with this CMS compared to others I have tried.

I would like to have a small change in the template cssmenu-accessible.tpl. I would like
Menuparent which has children to NOT show any link. It is a bit confusing that, if I choose
a menu item on parent level, that it then gives me the link to the main page and changes
away from the menuactive.

I have made the following change (attached), and I would like one of you competent guys
to have a look at it since I don't know if it produces correct XHTML code.
It works fine anyway (please see below extra lines of code marked in red).

Thanks in advance for any feedback.

Kind regards / Lars

Code: Select all

{* CSS classes used in this template:
#menuwrapper - The id for the <div> that the menu is wrapped in. Sets the width, background etc. for the menu.
#primary-nav - The id for the <ul>
.menuparent - The class for each <li> that has children.
.menuactive - The class for each <li> that is active or is a parent (on any level) of a child that is active. *}
{if $count > 0}
  <div id="menuwrapper">
  <ul id="primary-nav">
  {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="menuactive menuparent"><a class="menuactive menuparent" {elseif $node->current == true}
	<li class="menuactive"><a class="menuactive" {elseif $node->haschildren == true}
           <li class="menuparent"><a class="menuparent" {else}
	<li><a {/if}
{if !($node->haschildren == true)}

Code: Select all

href="{$node->url}"
{/if}

Code: Select all

    {if $node->accesskey != ''}accesskey="{$node->accesskey}" {/if}
    {if $node->tabindex != ''}tabindex="{$node->tabindex}" {/if}
    {if $node->titleattribute != ''}title="{$node->titleattribute}"{/if}
    {if $node->target ne ""} target="{$node->target}"{/if}
    ><dfn>{$node->hierarchy}: </dfn>{$node->menutext}</a>
  {/foreach}
	{repeat string="</li></ul>" times=$node->depth-1}
	</li></ul>
  <div class="clearb"></div>
  </div>
{/if}
User avatar
Dr.CSS
Moderator
Moderator
Posts: 12711
Joined: Thu Mar 09, 2006 5:32 am

Re: MenuManager - cssmenu-accessible.tpl - menuparent with children but no link

Post by Dr.CSS »

one way to tell if it passes XHTML...
make page regular that uses same type of menu, run it thru validater, if it passes change the template to use your menu then run it again...
first step is just so you don't have to wonder if any errors are from menu...
larskong

Re: MenuManager - cssmenu-accessible.tpl - menuparent with children but no link

Post by larskong »

Thnaks Mark,

Where to find the best XHTML validator? Which one would you use?

BR / Lars
larskong

Re: MenuManager - cssmenu-accessible.tpl - menuparent with children but no link

Post by larskong »

Hi All,

It is validated at http://validator.w3.org/ and was approved so the change seems to be ok.

Image

BR / Lars
Locked

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