[SOLVED] CMSMS 2.0 Navigator, ignoring section-header alias
Posted: Mon Oct 05, 2015 3:05 pm
Hey
I'm working up a bootstrap 3 navigator template
In 2.0 Navigator if I specify
<a href="{$node->url}">{$node->menutext}</a>
For a third level page (a child page of a section header) e.g:
domain.com/section-header/third-level-1
{$node->url} is giving me the URL
http://www.domain.com/third-level-1
ignoring the section header alias (section-header).
I was expecting the URL: domain.com/section-header/third-level-1
Can anyone spot what I'm doing wrong?? ..
Below is based on code from the French CMSMS forum:
{* this template uses recursion, but not a smarty function. *}
{*
variables:
node: contains the current node.
aclass: is used to build a string containing class names given to the a tag if one is used
liclass: is used to build a string containing class names given to the li tag.
*}
{if !isset($depth)}{$depth=0}{/if}
{strip}
{$caret=''}
{if $depth == 0}
<ul class='nav navbar-nav'>
{else}
<ul class='dropdown-menu' role='menu'>
{/if}
{$depth=$depth+1}
{foreach $nodes as $node}
{* creation and reset classes links and anchors *}
{$liclass=[]}
{$aclass=[]}
{if $depth == 1}{* if you are on the top Parent *}
{$liclass_top_parent[]='dropdown'} {* for top level section header *}
{$liclass[]='not-parent'} {* modify to suit your needed 'not parent' class *}
{$aclass[]='dropdown-toogle'}
{$aclass[]=$node->alias} {* delete if no alias in the class anchor *}
{elseif $node->children_exist}{* if the item has children *}
{$liclass[]='dropdown has-children'}
{$liclass[]='dropdown-submenu'}
{$aclass[]='dropdown'}
{$aclass[]='dropdown-toogle'}
{$aclass[]=$node->alias}{* delete if no alias in the class anchor *}
{else}
{$aclass[]=''}
{/if}
{* build the menu item from the node *}
{if $node->type == 'sectionheader'}
<li class='{implode(' ',$liclass_top_parent)} {if isset($node->children)} q{/if} {if $node->current} active {/if} ' ><a{if count($aclass) > 0} class="{implode(' ',$aclass)}"{/if} a href="#">{$node->menutext}</a>
{if isset($node->children)}
{include file=$smarty.template nodes=$node->children}
{/if}
</li>
{elseif $depth == 1}
<li class="{implode(' ',$liclass)} {if $node->current} active {/if}">
<a{if count($aclass) > 0} class="{implode(' ',$aclass)}"{/if} href="{$node->url}" data-toggle='dropdown' data-target='#' target='_self'>{$node->menutext} {$caret}</a>
{if isset($node->children)}
{include file=$smarty.template nodes=$node->children}
{/if}
</li>
{elseif $node->type == 'separator'}
<li style="list-style-type: none;"><hr class="menu_separator"/></li>
{else}
<li{if count($liclass) > 0} class="{implode(' ',$liclass)} {if $node->current} active {/if}"{/if}>
<a{if count($aclass) > 0} class="{implode(' ',$aclass)}"{/if} href="{$node->url}">{$node->menutext}</a>
{if isset($node->children)}
{include file=$smarty.template nodes=$node->children}
{/if}
</li>
{/if}
{/foreach}
{$depth=$depth-1}
</ul>
{/strip}
I'm working up a bootstrap 3 navigator template
In 2.0 Navigator if I specify
<a href="{$node->url}">{$node->menutext}</a>
For a third level page (a child page of a section header) e.g:
domain.com/section-header/third-level-1
{$node->url} is giving me the URL
http://www.domain.com/third-level-1
ignoring the section header alias (section-header).
I was expecting the URL: domain.com/section-header/third-level-1
Can anyone spot what I'm doing wrong?? ..
Below is based on code from the French CMSMS forum:
{* this template uses recursion, but not a smarty function. *}
{*
variables:
node: contains the current node.
aclass: is used to build a string containing class names given to the a tag if one is used
liclass: is used to build a string containing class names given to the li tag.
*}
{if !isset($depth)}{$depth=0}{/if}
{strip}
{$caret=''}
{if $depth == 0}
<ul class='nav navbar-nav'>
{else}
<ul class='dropdown-menu' role='menu'>
{/if}
{$depth=$depth+1}
{foreach $nodes as $node}
{* creation and reset classes links and anchors *}
{$liclass=[]}
{$aclass=[]}
{if $depth == 1}{* if you are on the top Parent *}
{$liclass_top_parent[]='dropdown'} {* for top level section header *}
{$liclass[]='not-parent'} {* modify to suit your needed 'not parent' class *}
{$aclass[]='dropdown-toogle'}
{$aclass[]=$node->alias} {* delete if no alias in the class anchor *}
{elseif $node->children_exist}{* if the item has children *}
{$liclass[]='dropdown has-children'}
{$liclass[]='dropdown-submenu'}
{$aclass[]='dropdown'}
{$aclass[]='dropdown-toogle'}
{$aclass[]=$node->alias}{* delete if no alias in the class anchor *}
{else}
{$aclass[]=''}
{/if}
{* build the menu item from the node *}
{if $node->type == 'sectionheader'}
<li class='{implode(' ',$liclass_top_parent)} {if isset($node->children)} q{/if} {if $node->current} active {/if} ' ><a{if count($aclass) > 0} class="{implode(' ',$aclass)}"{/if} a href="#">{$node->menutext}</a>
{if isset($node->children)}
{include file=$smarty.template nodes=$node->children}
{/if}
</li>
{elseif $depth == 1}
<li class="{implode(' ',$liclass)} {if $node->current} active {/if}">
<a{if count($aclass) > 0} class="{implode(' ',$aclass)}"{/if} href="{$node->url}" data-toggle='dropdown' data-target='#' target='_self'>{$node->menutext} {$caret}</a>
{if isset($node->children)}
{include file=$smarty.template nodes=$node->children}
{/if}
</li>
{elseif $node->type == 'separator'}
<li style="list-style-type: none;"><hr class="menu_separator"/></li>
{else}
<li{if count($liclass) > 0} class="{implode(' ',$liclass)} {if $node->current} active {/if}"{/if}>
<a{if count($aclass) > 0} class="{implode(' ',$aclass)}"{/if} href="{$node->url}">{$node->menutext}</a>
{if isset($node->children)}
{include file=$smarty.template nodes=$node->children}
{/if}
</li>
{/if}
{/foreach}
{$depth=$depth-1}
</ul>
{/strip}