Menu Template, display parent in the subnavigation. [not solved]

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"
calguy1000
Support Guru
Support Guru
Posts: 8169
Joined: Tue Oct 19, 2004 6:44 pm

Re: Menu Template, display parent in the subnavigation. [not solved]

Post 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;
}
Follow me on twitter
Please post system information from "Extensions >> System Information" (there is a bbcode option) on all posts asking for assistance.
--------------------
If you can't bother explaining your problem well, you shouldn't expect much in the way of assistance.
User avatar
Dr.CSS
Moderator
Moderator
Posts: 12711
Joined: Thu Mar 09, 2006 5:32 am

Re: Menu Template, display parent in the subnavigation. [not solved]

Post by Dr.CSS »

Hannson

How did you do it?...
hannson

Re: Menu Template, display parent in the subnavigation. [not solved]

Post 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>
Locked

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