Friday 20 October 2006 3:30:12 pm
Hi Remi The selected top level node is usually the second node in the path of the currently viewed node. So just check that such a node exists and fetch the data:
{if and(is_set($module_result.path),
$module_result.path|count()|ge(2))}
{* arrays are zero based, thus the second entry has the array key 1 *}
{def $pathItem = $module_result.path['1']}
{* if we currently view this node, the url_alias of pathItem is set to false so we need to fetch it from $module_result.content_info *}
{if $pathItem.url_alias}
<a href={$pathItem.url_alias|ezurl()} title="{$pathItem.text}">{$pathItem.text}</a>
{else}
<a href={$module_result.content_info.url_alias|ezurl()} title="{$pathItem.text}">{$pathItem.text}</a>
{/if}
{/if}
Ok now we have the link to the desired node which you just need to place on a good point in the menu. As far as I recall the flat_left template the treemenu is created as an unordered list. In this case you just need to add an additional list element around it:
<ul>
<li>...add here the link we just created
{* Add the whole treemenu in there now, I think it starts with an {let... tag *}
{* close the li and ul again *}
</li>
</ul>
Please note that you should add the opening and closing ul and li only if there is a link to the selected top level node (the code above will most likely not work if you view something that is not a node, e.g the shop). Alternatively just add the new link as an heading on top of the treemenu or whatever fits into your html structure. As usual the code above is not tested. If you have problems just ask. Greetings from Luxembourg Claudia
|