Treemenu

Author Message

Ekkehard Dörre

Sunday 06 April 2003 3:52:51 am

Hi,
I built a tree menu like this:

--Frontpage
---- Food for the soul
---- A weekend in the mountain
--Sport
--Action
--World news
--Leisure

when you click on Sport, You get this:
--Frontpage
--Sport
----We did it again
----Sports weekend
--Action
--World news
--Leisure

but, when you click on "We did it again" then it is like this:
--Frontpage
--Sport
--Action
--World news
--Leisure

Itis because of this: {section show=eq($Folder:item.node_id,$DesignKeys:used.node)}
where $Folder:item.node_id is the node_id from the "fetch" and $DesignKeys:used.node the actual used node from the page.

{section name=Folder}
{section loop=fetch(content,list,hash(parent_node_id,24, class_filter_type, "include", class_filter_array, array(1,2),sort_by,array(array(priority))))}
<tr>
<td class="path">--<a class="path" href={concat("/content/view/full/",$Folder:item.node_id,"/")|ezurl}>{$Folder:item.name}</a></td>
</tr>
{section show=eq($Folder:item.node_id,$DesignKeys:used.node)}
{section loop=fetch(content,tree,hash(parent_node_id,$DesignKeys:used.node, class_filter_type, "include", class_filter_array, array(2),sort_by,array(array(priority))))}
<tr>
<td class="path">----<a class="path" href={concat("/content/view/full/",$Folder:item.node_id,"/")|ezurl}> {$Folder:item.name}</a></td>
</tr>
{/section}
{/section}
{/section}
{/section}

Who to get it work or (a dream):with more depth like this without hardcoding of parent_node_id in the template:

--menu1
--menu2
----submenu1
------subsubmenu1
--------subsubsubmenu1
------subsubmenu2
----submenu2
--menu3

but only open a submenu when the parent menu is open. Any Ideas?
You can see what I want on http://www.georg-fischer.de click on Portfolio
Thanks, ekke

PS: I saw the wiki http://ezwiki.blanko.info/index.php/3XHT_TmplObjTree but it didn't helped me.

http://www.coolscreen.de - Over 40 years of certified eZ Publish know-how: http://www.cjw-network.com
CJW Newsletter: http://projects.ez.no/cjw_newsletter - http://cjw-network.com/en/ez-publ...w-newsletter-multi-channel-marketing

Darius Loktevic

Monday 07 April 2003 1:08:21 am

Can ez make better docs? :(

Kai Duebbert

Monday 07 April 2003 1:27:57 am

Ok, I made a first rough solution. Have a look at the new page: http://ezwiki.blanko.info/index.php/3XHT_TmplObjTree

It's rough, so if anyone has improvements, please contribute! I just couldn't get the "contains" function to work as a show parameter for section. That would simplify it.

Also, it accomodates for three levels so far, but extending it (read: repeating some code) is trivial.

Post your improvements.

Kai

Jan Borsodi

Monday 07 April 2003 5:22:29 am

{let current_node=fetch(content,node,hash(node_id,$DesignKeys:used.node))}
... loop trough menu
{section show=$current_node.path_array|contains($Folder:item.node_id)}

Expand item...

{/section}
...
{/let}

path_array returns the path of the node as an array of node IDs.

There's also the treemenu template operator which was shipped with 3.0, it is not general but can used as basis for your own menu operator. See kernel/commom/eztreemenuoperator.php for the code.

Updated: Made sure the node was fetched before using it.

--
Amos

Documentation: http://ez.no/ez_publish/documentation
FAQ: http://ez.no/ez_publish/documentation/faq

Ekkehard Dörre

Monday 07 April 2003 6:08:04 am

Wonderfull,

on http://ezwiki.blanko.info/index.php/3XHT_TmplObjTree
I wrote:
Same as "A first solution" but extended with 4 Levels, with marking active menue and Links added.

Big THANKS to Kai Duebbert

Oh while I'm working a new Post came in, I'll try it.

ekke

http://www.coolscreen.de - Over 40 years of certified eZ Publish know-how: http://www.cjw-network.com
CJW Newsletter: http://projects.ez.no/cjw_newsletter - http://cjw-network.com/en/ez-publ...w-newsletter-multi-channel-marketing

Kai Duebbert

Monday 07 April 2003 8:01:52 pm

Hi,

Thanks Jan and Ekke. I rewrote the whole tree menu page so it combines all suggestions. The code is much tighter now. BTW Jan, $DesignKeys:used.node hands back the node_id, not a node object. So it doesn't have a path_array. (At least that's how it is in v3.0.)

Have a look at http://ezwiki.blanko.info/index.php/3XHT_TmplObjTree again. I also extended the marking of the active menu so that it also marks the parent menus a bit. Now this page should explain better how to create a tree menu.

I'm glad this works now because we need it too.

Kai

Kristjan Klementi

Tuesday 08 April 2003 12:08:20 am

Thanks a lot
I personally find it very difficult to make the templates.... Never done them before So any template structure that can be copied is always welcome to me.

As I like the "Nice URL's" that this template did not produce I just changed the href tag with
href={$:item.url_alias|ezurl}>
Just great. I just learned that trick now, and maybe thats usefull also to somebody else
Cheers / Kristjan

Ekkehard Dörre

Tuesday 08 April 2003 2:59:59 am

@all: Thanks, it's great
@ Kristjan: I put it into the WIKI:
http://ezwiki.blanko.info/index.php/3XHT_NiceUrls

ekke

http://www.coolscreen.de - Over 40 years of certified eZ Publish know-how: http://www.cjw-network.com
CJW Newsletter: http://projects.ez.no/cjw_newsletter - http://cjw-network.com/en/ez-publ...w-newsletter-multi-channel-marketing

Kristjan Klementi

Tuesday 08 April 2003 4:18:36 am

I played around today in my site I am making and I managed to get to an error "module not found".
With this the nice meny was all messed around dispaying everything possible to display. Got the same result with empty search.
So My thougt is that maybe it needs another "IF Then Else" function implemented inside of that. And I also thought that maybe some nice guys can think it out, if I mention that ?
/ Kristjan

Karsten Jennissen

Tuesday 08 April 2003 4:30:21 am

Maybe you find some help here:

http://ez.no/developer/ez_publish_3/forum/setup_design/nice_urls

Karsten

Kai Duebbert

Tuesday 08 April 2003 7:37:13 pm

Hi,

I fixed the "no module" problem. See if you still have problems: http://ezwiki.blanko.info/index.php/3XHT_TmplObjTree

Kai

Kristjan Klementi

Wednesday 09 April 2003 5:06:52 am

Just about getting better and better.
That 'no module problem' is gone for me now.
Great . thanks for help.
/ Kristjan

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2014 eZ Systems AS (except where otherwise noted). All rights reserved.