Page 2 of 2
Re: Menu Template, display parent in the subnavigation. [not solved]
Posted: Thu Aug 23, 2007 7:24 pm
by calguy1000
Code: Select all
/* Get the alias of the top level parent
Takes a page alias as input
outputs a page alias, or an empty string if the alias input is a top level
*/
if( !isset($params['alias']) ) return;
global $gCms;
$contentops =& $gCms->GetContentOperations();
$alias = '';
$id = $contentops->GetPageIDFromAlias( $params['alias'] );
while( $id != -1 )
{
$content =& $contentops->LoadContentFromId( $id );
if( is_object( $content ) ) {
$alias = $content->Alias();
$id = $content->ParentId();
}
}
if( isset($params['assign']) )
{
$smarty =& $gCms->GetSmarty();
$smarty->assign( $params['assign'], $alias );
return;
}
else
{
return $alias;
}
Re: Menu Template, display parent in the subnavigation. [not solved]
Posted: Thu Aug 23, 2007 8:55 pm
by Dr.CSS
Hannson
How did you do it?...
Re: Menu Template, display parent in the subnavigation. [not solved]
Posted: Mon Aug 27, 2007 3:39 pm
by hannson
I just hacked some code together
Code: Select all
<div id="navigation">
{if $count > 0}
<ul>
{foreach from=$nodelist item=node}
{if $node->depth == 1}
{if $node->depth < $node->prevdepth} </ul> {/if}
<li{if $node->current == true or $node->parent == true} class="active"{/if}><a href="{$node->url}" {if $node->target ne ""} target="{$node->target}"{/if}>{$node->menutext}</a>
<ul class="depth1">
{if !$node->haschildren}
</ul></li>
{else}
<li{if $node->current == true} class="active"{/if}><a href="{$node->url}" {if $node->target ne ""} target="{$node->target}"{/if}>{$node->menutext}</a></li>
{/if}
{else}
<li{if $node->current == true} class="active"{/if}><a href="{$node->url}" {if $node->target ne ""} target="{$node->target}"{/if}>{$node->menutext}</a></li>
{/if}
{if $node->depth < $node->prevdepth} <!-- 1 ---> {/if}
{/foreach}
</ul>
{/if}
</div>