Forums / Setup & design / Have a path-section inside templates

Have a path-section inside templates

Author Message

Robin Sørlie

Monday 25 October 2004 3:25:46 pm

In a site, we have a section with links, sorted in categories with subcategories with sub-subcategories etc..

Inside the category template we want a path-section wich shows the user where he is in the structure. The path in pagelayout is working, but I can't seem to get it to work when I use it in a template. I might be tired, and don't see the solution of a simple task :)

Anyone that can help me in the right direction?

Btw: I have tried various versions of this code:
<p>
{section name=Path loop=$module_result.path}
{section show=$Path:item.url}
{section show=is_set($Path:item.url_alias)}
<a href={$Path:item.url_alias|ezurl}>{$Path:item.text|wash}</a> /
{section-else}
<a href={$Path:item.url|ezurl}>{$Path:item.text|wash}</a> /
{/section}
{section-else}
{$Path:item.text|wash}
{/section}
{section-else}
{/section}
</p>

Silke Fox

Tuesday 26 October 2004 3:50:08 am

The problem is that $module_result is available in pagelayout.tpl only.
In "view" templates you can access the nodes path with {$node.path_array},
but it doesn't contain the name and url_alias - only the node ids.
You could loop through this array and fetch every node to get its name etc.
with fetch("content","node",hash(node_id,...)).

Hope this helps a bit.
silke