Forums / Setup & design / Treemenu

Treemenu

Author Message

Daniel Hubbell

Saturday 20 August 2005 8:32:38 pm

Treemenu requires a path parameter and the documentation states this would normally be $module_result.path. However, $module_result.path seems to be not available in display templates. Is there another variable I can use in its place or is treemenu just not usable outside of the pagelayout template? This question has been asked 1/2 dozen times in the forums but has never been answered.

Could someone answer this question so I can move on.

Thank you,

Dan Hubbell
Gobles Public Schools

Peter Dabrowski

Wednesday 24 August 2005 4:56:47 am

I've got the same problem.
Trying to have breadcrumbs navigation in one section only.

I"m trying to use path_array in code below, but cannot get names displayed

{section name=Path loop=$node.path_array }
{section show=$Path:item.url}
<a href={$Path:item.url_alias|ezurl}>{$Path:item.text|shorten(50)}</a>
{section-else}
{$Path:item.text|shorten(50)}
{/section}
{delimiter}&gt;{/delimiter}
{/section}

So I would like to hear on this subject to.
Thanks
Peter

David Eriksson

Wednesday 24 August 2005 5:46:54 am

You can "build" your own path variable.

{set $path=array(
                hash('text', $specialnode.parent.parent.name, 'url', concat('/content/view/full/', $specialnode.parent.parent_node_id), 'url_alias', $specialnode.parent.parent.url_alias, 'node_id', $specialnode.parent.parent_node_id),
                hash('text', $specialnode.parent.name, 'url', concat('/content/view/full/', $specialnode.parent_node_id), 'url_alias', $specialnode.parent.url_alias, 'node_id', $specialnode.parent_node_id),
                hash('text', $specialnode.name, 'url', false(), 'url_alias', false(), 'node_id', '365')
                )}

The longer path you need, the more work it is obviously. The path above has 3 levels. Play around with it, and print out the ordinary treemenu() with attribute(show) and you should be able to puzzle it together. :)

/David

Peter Dabrowski

Sunday 28 August 2005 12:30:07 am

Hi David,

Tried to print {treemenu()|attribute(show)} but getting only headers.

Peter

Peter Dabrowski

Sunday 28 August 2005 12:35:05 am

Hi,
This code showing the path as what I want.
Haw to make it clicable?
I want to come back to one of previous pages.
{section loop=$node.path_array offset=2}
{let node_name=fetch( content, node, hash( node_id, $item ) )}
{$node_name.name}
{/let}
{delimiter}
>
{/delimiter}
{/section}

Thanks
Peter

Kristof Coomans

Sunday 28 August 2005 4:28:15 am

You can make it clickable by using $node.url_alias and ezurl. Don't forget to wash the node's name!

{section loop=$node.path_array offset=2}
    {let node_name=fetch( content, node, hash( node_id, $item ) )}
        <a href={$node.url_alias|ezurl}>{$node_name.name|wash}</a>
{/let}
{delimiter}
&gt;
{/delimiter}
{/section}

independent eZ Publish developer and service provider | http://blog.coomanskristof.be | http://ezpedia.org

Peter Dabrowski

Sunday 28 August 2005 6:02:13 am

Thanks Kristof,

I've changed:
<a href={$node.url_alias|ezurl}>{$node_name.name|wash}</a>

to read:

<a href={$node_name.url_alias|ezurl}>{$node_name.name|wash}</a>

working code:

{section loop=$node.path_array offset=2}
{let node_name=fetch( content, node, hash( node_id, $item ) )}
<a href={$node_name.url_alias|ezurl}>{$node_name.name|wash}</a>

{/let}
{delimiter}
&gt;
{/delimiter}
{/section}

Another question:
How to change this code so current node is printed as a text only , and is not clicable?

Thanks
Peter