Forums / Setup & design / Treemenu

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

eZ debug

Timing: Jan 18 2025 02:12:35
Script start
Timing: Jan 18 2025 02:12:35
Module start 'content'
Timing: Jan 18 2025 02:12:36
Module end 'content'
Timing: Jan 18 2025 02:12:36
Script end

Main resources:

Total runtime1.0122 sec
Peak memory usage4,096.0000 KB
Database Queries229

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0064 588.9688180.8516
Module start 'content' 0.00640.8482 769.8203806.6719
Module end 'content' 0.85460.1575 1,576.4922353.3359
Script end 1.0121  1,929.8281 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00400.3956210.0002
Check MTime0.00150.1465210.0001
Mysql Total
Database connection0.00070.067110.0007
Mysqli_queries0.900188.92712290.0039
Looping result0.00310.30142270.0000
Template Total0.978496.720.4892
Template load0.00240.234520.0012
Template processing0.976096.426420.4880
Template load and register function0.00010.008910.0001
states
state_id_array0.00160.159210.0016
state_identifier_array0.00180.181520.0009
Override
Cache load0.00230.22261220.0000
Sytem overhead
Fetch class attribute can translate value0.00220.220670.0003
Fetch class attribute name0.00190.1887140.0001
XML
Image XML parsing0.00180.177970.0003
class_abstraction
Instantiating content class attribute0.00000.0029160.0000
General
dbfile0.00350.3500340.0001
String conversion0.00000.001030.0000
Note: percentages do not add up to 100% because some accumulators overlap

CSS/JS files loaded with "ezjscPacker" during request:

CacheTypePacklevelSourceFiles
CSS0extension/community/design/community/stylesheets/ext/jquery.autocomplete.css
extension/community_design/design/suncana/stylesheets/scrollbars.css
extension/community_design/design/suncana/stylesheets/tabs.css
extension/community_design/design/suncana/stylesheets/roadmap.css
extension/community_design/design/suncana/stylesheets/content.css
extension/community_design/design/suncana/stylesheets/star-rating.css
extension/community_design/design/suncana/stylesheets/syntax_and_custom_tags.css
extension/community_design/design/suncana/stylesheets/buttons.css
extension/community_design/design/suncana/stylesheets/tweetbox.css
extension/community_design/design/suncana/stylesheets/jquery.fancybox-1.3.4.css
extension/bcsmoothgallery/design/standard/stylesheets/magnific-popup.css
extension/sevenx/design/simple/stylesheets/star_rating.css
extension/sevenx/design/simple/stylesheets/libs/fontawesome/css/all.min.css
extension/sevenx/design/simple/stylesheets/main.v02.css
extension/sevenx/design/simple/stylesheets/main.v02.res.css
JS0extension/ezjscore/design/standard/lib/yui/3.17.2/build/yui/yui-min.js
extension/ezjscore/design/standard/javascript/jquery-3.7.0.min.js
extension/community_design/design/suncana/javascript/jquery.ui.core.min.js
extension/community_design/design/suncana/javascript/jquery.ui.widget.min.js
extension/community_design/design/suncana/javascript/jquery.easing.1.3.js
extension/community_design/design/suncana/javascript/jquery.ui.tabs.js
extension/community_design/design/suncana/javascript/jquery.hoverIntent.min.js
extension/community_design/design/suncana/javascript/jquery.popmenu.js
extension/community_design/design/suncana/javascript/jScrollPane.js
extension/community_design/design/suncana/javascript/jquery.mousewheel.js
extension/community_design/design/suncana/javascript/jquery.cycle.all.js
extension/sevenx/design/simple/javascript/jquery.scrollTo.js
extension/community_design/design/suncana/javascript/jquery.cookie.js
extension/community_design/design/suncana/javascript/ezstarrating_jquery.js
extension/community_design/design/suncana/javascript/jquery.initboxes.js
extension/community_design/design/suncana/javascript/app.js
extension/community_design/design/suncana/javascript/twitterwidget.js
extension/community_design/design/suncana/javascript/community.js
extension/community_design/design/suncana/javascript/roadmap.js
extension/community_design/design/suncana/javascript/ez.js
extension/community_design/design/suncana/javascript/ezshareevents.js
extension/sevenx/design/simple/javascript/main.js

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1node/view/full.tplfull/forum_topic.tplextension/sevenx/design/simple/override/templates/full/forum_topic.tplEdit templateOverride template
4content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
12content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
16content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
22content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
1pagelayout.tpl<No override>extension/sevenx/design/simple/templates/pagelayout.tplEdit templateOverride template
 Number of times templates used: 56
 Number of unique templates used: 6

Time used to render debug report: 0.0002 secs