Page 1 of 1

[Solved] Named links in menu

Posted: Wed Sep 05, 2007 6:11 pm
by kcaldwell1123
I am in the process of importing a template and am having some difficulty with a menu.  I am including a link to the site.  On the left hand menu the top menu is the one I am working on in the Menu Manager the bottom one is hard coded in.  What I am trying to do is get the top to look like the bottom.

http://bogeybluesgolf.com/cms/index.php?page=basic-options-content


I have gotten the first level of the menu to work.  Underneath the first level are named links in the document.  The named link is working correctly, but it does not display as desired.  I created the second level links under Content > Pages as links.  I am including the source for the bad menu and the good menu.

Bad Menu Code:

Code: Select all

<ul>
<li class="title">Basic Options</li>
<li class="selected"><dfn>Current page is 8.2: </dfn>Content Area
  <ul>
    <li class='group'><a href="http://bogeybluesgolf.com/cms/index.php?page=basic-options-content#textboxstyle"><dfn>8.2.1: </dfn>Textbox Style</a></li>
  </ul>
</li>
<li class='group'><a href="http://bogeybluesgolf.com/cms/index.php?page=sidebar-area"><dfn>8.3: </dfn>Sidebar Area</a></li>
<li class='group'><a href="http://bogeybluesgolf.com/cms/index.php?page=printer-stylesheet"><dfn>8.4: </dfn>Printer Stylesheet</a></li>
</ul>
Good Menu Code:

Code: Select all

<ul>
<li class="title">Basic Options</li>
<li class="group"><a href="options_basic_content.html" class="selected">Content Area</a></li>
<li><a href="#columnlayout">Column Layout</a></li>
<li><a href="#titleplacement">Title Placement</a></li>
<li><a href="#titlestyle">Title Style</a></li>
<li><a href="#titlesize">Title Size</a></li>
<li><a href="#titlestyle">Subtitle Style</a></li>
<li><a href="#titlesize">Subtitle Size</a></li>
<li><a href="#textboxstyle">Textbox Style</a></li>
<li><a href="#pictures">Pictures</a></li>
<li><a href="#tables">Tables</a></li><li><a href="#text">Text</a></li>
<li class="group"><a href="options_basic_sidebar.html">Sidebar Area</a></li>
<li class="group"><a href="options_basic_print.html">Printer Stylesheet</a></li>
</ul>
What I am guessing that is messing this up is the extra tags but I am not sure how remove them and the [class='group'] should not be there either.

Thanks!
Kenny

Re: Named links in menu

Posted: Wed Sep 05, 2007 8:00 pm
by kcaldwell1123
I figured this out I think, but it would be nice if somebody would take a look and let me know if they see any potential problems.  I changed the Menu Template...I removed the node depth to prevent extra and tags and added an elseif nodedepth == 2 for the link creation.

Code: Select all

{* CSS classes used in this template:
.activeparent - The top level parent when a child is the active/current page
li.active0n h3 - n is the depth/level of the node. To style the active page for each level separately. The active page is not clickable.
.clearfix - Used for the unclickable h3 to use the entire width of the li, just like the anchors. See the Tools stylesheet in the default CMSMS installation.
li.sectionheader h3 - To style section header
li.separator - To style the ruler for the separator *} 

{if $count > 0}
<ul>
{foreach from=$nodelist item=node}

{if $node->current == true}
<li class="selected"><dfn>Current page is {$node->hierarchy}: </dfn>{$node->menutext}

{elseif $node->parent == true}
{* <li class="activeparent"> *}
<li class="group"><a class="activeparent" href="{$node->url}"{if $node->accesskey != ''} accesskey="{$node->accesskey}"{/if}{if $node->tabindex != ''} tabindex="{$node->tabindex}"{/if}{if $node->titleattribute != ''} title="{$node->titleattribute}"{/if}><dfn>{$node->hierarchy}: </dfn>{$node->menutext}</a>

{elseif $node->type == 'sectionheader'}
{* <li class="sectionheader">{$node->menutext} *}
<li class="title">{$node->menutext}

{elseif $node->type == 'separator'}
<li class="separator" style="list-style-type: none;"> <hr />

{elseif $node->depth == 2}
<li><a href="{$node->url}"{if $node->accesskey != ''} accesskey="{$node->accesskey}"{/if}{if $node->tabindex != ''} tabindex="{$node->tabindex}"{/if}{if $node->titleattribute != ''} title="{$node->titleattribute}"{/if}{if $node->target != ''} target="{$node->target}"{/if}><dfn>{$node->hierarchy}: </dfn>{$node->menutext}</a>

{else}
<li class='group'><a href="{$node->url}"{if $node->accesskey != ''} accesskey="{$node->accesskey}"{/if}{if $node->tabindex != ''} tabindex="{$node->tabindex}"{/if}{if $node->titleattribute != ''} title="{$node->titleattribute}"{/if}{if $node->target != ''} target="{$node->target}"{/if}><dfn>{$node->hierarchy}: </dfn>{$node->menutext}</a>

{/if}

{/foreach}
{repeat string="</li></ul>" times=$node->depth-1}</li>
</ul>
{/if}
Thanks!
Kenny

Re: Named links in menu

Posted: Wed Sep 05, 2007 8:12 pm
by Dr.CSS
If it works for you go for it...