Tweaking PHP

In the following bit of PHP I’m wondering if the {$node->menutext} can be added to, so that it always shows the level one header rather than the header of the current page. If the current page is a sub menu item then I still want the parent page title to display. Does that make any sense?

{* 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}

    {foreach from=$nodelist item=node} {if $node->depth > $node->prevdepth} {repeat string="
      " times=$node->depth-$node->prevdepth} {elseif $node->depth < $node->prevdepth} {repeat string="
    " times=$node->prevdepth-$node->depth} {elseif $node->index > 0} {/if}

    {if $node->parent == true or ($node->current == true and $node->haschildren == true)}

  • {$node->menutext}

    {elseif $node->haschildren == true and $node->type != ‘sectionheader’ and $node->type != ‘separator’}

  • {$node->menutext}

    {elseif $node->current == true}

  • {$node->menutext}

    {elseif $node->type == ‘sectionheader’}

  • {$node->menutext}

    {elseif $node->type == ‘separator’}


  • {else}

  • {$node->menutext}

    {/if}

    {/foreach}
    {repeat string="

" times=$node->depth-1} {/if}

Any help greatly appreciated.

jude x

Sponsor our Newsletter | Privacy Policy | Terms of Service