new menu

Author Message

tady d.

Tuesday 05 December 2006 9:17:46 am

I have menu like that:

-parentfolder1
  -childfolder1
  -childfolder2
  -childfolder3
  -childfolder4
-parentfolder2

How to create new menu:

-childfolder1
-childfolder2
-childfolder3
-childfolder4

I searched about that, but I'm beginner and I can not understand how to do that.

tady

tady d.

Tuesday 05 December 2006 9:40:26 am

I made it by this way. I had double top menu and I just add flat_left menu and now i have 2 menus, but the same. How to change flat_left.tpl - I want him to have only childfolders o one folder.
my double_top menu:

-parentfolder1
  -childfolder1
  -childfolder2
-parentfolder2

a and I want change flat_left.tpl to see that in my left menu:

-childfolder1
-childfolder2

How to do that?

Jon Staines

Monday 11 December 2006 5:56:23 am

Change the 'depth_skip' value from 0 to 1 so that you treemenu call in the flat_left template looks like:

{let docs=treemenu( $module_result.path,
                    is_set( $module_result.node_id )|choose( 2, $module_result.node_id ),
                    ezini( 'MenuContentSettings', 'LeftIdentifierList', 'menu.ini' ),
                    1, 5 )
                    depth=1
                    last_level=0}

This way, the 1st level of the tree is skipped, so it will show the children of the node you are on. Give it a try.

The 'depth_skip' is explained at: http://ez.no/doc/ez_publish/technical_manual/3_6/reference/template_operators/miscellaneous/treemenu

tady d.

Monday 11 December 2006 6:25:25 am

thx, and where I can decide, which folder should be show? (I mean folder which include the childfolders)

Jon Staines

Monday 11 December 2006 6:54:22 am

It will show the children of whichever folder is selected at the moment. So if your menu structure is:

-News
 -story 1
-Links
 -link 1
 -link 2
-Files
 -file 1
 -file 2
 -file 3

And the user goes into the Files page, then left menu will show the level beneath Files, so the menu would be:

-file 1
-file 2
-file 3

Marcin N.

Tuesday 12 December 2006 6:58:29 am

Hi!

I take code from flat_left.tpl and changed top <b>{let...</b> and I when I clear cache from admin interface then I see "new menu". BUT when I click item from top menu then my "new menu" is still the same. It changes only when I clear the cache (from admin panel) and refresh the browser. It's strange.

My menu is placed in pagelayout.tpl as:

{menu name=LeftMenu}

My <i>new_menu</i>.tpl:

{let docs=treemenu( $module_result.path,
                    is_set( $module_result.node_id )|choose( 2, $module_result.node_id ),
                    ezini( 'MenuContentSettings', 'LeftIdentifierList', 'menu.ini' ),
                    0, 5 )
                    depth=1
                    last_level=0}
        <ul>
        {section var=menu loop=$:docs last-value}
            {set last_level=$menu.last|is_array|choose( $menu.level, $menu.last.level )}
            {section show=and( $last_level|eq( $menu.level ), $menu.number|gt( 1 ) )}
                </li>
            {section-else}
            {section show=and( $last_level|gt( $menu.level ), $menu.number|gt( 1 ) )}
                </li>
                    {"</ul>
                </li>"|repeat(sub( $last_level, $menu.level ))}
            {/section}
            {/section}

            {section show=and( $last_level|lt( $menu.level ), $menu.number|gt( 1 ) )}
                {'<ul><li>'|repeat(sub($menu.level,$last_level,1))}
                <ul>
                    <li class="menu-level-{$menu.level}">
            {section-else}
                <li class="menu-level-{$menu.level}">
            {/section}

            <a {$menu.is_selected|choose( '', 'class="selected"' )} href={$menu.url_alias|ezurl}>{$menu.text|shorten( 25 )}</a>

            {set depth=$menu.level}
        {/section}
           </li>

        {section show=sub( $depth, 0 )|gt( 0 ) loop=sub( $depth, 0 )}
            </ul>
        </li>
        {/section}
        </ul>

{/let}

Marcin

Jon Staines

Tuesday 12 December 2006 7:39:08 am

An example will make this easier, have a look at:
http://pyramint.emcuk.com/ezdemo/
Different options in the top menu change the left menu, News has 2 folders in, Media Files has one.

Is this what you are trying to do?

Marcin N.

Tuesday 12 December 2006 7:43:52 am

Yes, exact the same.
How to do this?
My code is OK or not?

Marcin

Jon Staines

Tuesday 12 December 2006 7:52:25 am

See the third post in this topic. All you need is to have an override on the left menu and change the depth_skip to 1.

{let docs=treemenu( $module_result.path,
                    is_set( $module_result.node_id )|choose( 2, $module_result.node_id ),
                    ezini( 'MenuContentSettings', 'LeftIdentifierList', 'menu.ini' ),
                    1, 5 )
                    depth=1
                    last_level=0}

instead of

{let docs=treemenu( $module_result.path,
                    is_set( $module_result.node_id )|choose( 2, $module_result.node_id ),
                    ezini( 'MenuContentSettings', 'LeftIdentifierList', 'menu.ini' ),
                    0, 5 )
                    depth=1
                    last_level=0}

Marcin N.

Tuesday 12 December 2006 8:17:16 am

I found the problem!
In pagelayout.tpl I moved:

{menu name=LeftMenu}

I forgot about cache-block:

{cache-block keys=array($uri_string, $current_user.role_id_list|implode( ',' ), $current_user.limited_assignment_value_list|implode( ',' ))}
   {menu name=LeftMenu}
{/cache-block}

clear! :)

Marcin

Marcin N.

Tuesday 12 December 2006 8:33:46 am

One more question.
How to check in this example that folders in "new menu" exisit?
I would like to check it to add DIV with graphics element.

Marcin

Jon Staines

Tuesday 12 December 2006 8:46:57 am

Play around with something like:

{if eq($:docs|count(),0)}

Marcin N.

Tuesday 12 December 2006 9:13:48 am

Works!
Thanks! :)

Marcin

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

eZ debug

Timing: Jan 18 2025 11:24:36
Script start
Timing: Jan 18 2025 11:24:36
Module start 'layout'
Timing: Jan 18 2025 11:24:36
Module start 'content'
Timing: Jan 18 2025 11:24:38
Module end 'content'
Timing: Jan 18 2025 11:24:38
Script end

Main resources:

Total runtime1.4885 sec
Peak memory usage4,096.0000 KB
Database Queries89

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0062 589.5625152.6094
Module start 'layout' 0.00620.0034 742.171939.3984
Module start 'content' 0.00961.4775 781.5703671.8828
Module end 'content' 1.48710.0014 1,453.453124.2031
Script end 1.4885  1,477.6563 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00320.2151160.0002
Check MTime0.00130.0883160.0001
Mysql Total
Database connection0.00080.053410.0008
Mysqli_queries1.394693.6894890.0157
Looping result0.00080.0554870.0000
Template Total1.424295.720.7121
Template load0.00230.155020.0012
Template processing1.421995.522820.7109
Template load and register function0.00010.010010.0001
states
state_id_array0.00120.079810.0012
state_identifier_array0.00150.102320.0008
Override
Cache load0.00190.1277770.0000
Sytem overhead
Fetch class attribute can translate value0.00080.054930.0003
Fetch class attribute name0.00180.1212140.0001
XML
Image XML parsing0.00080.053730.0003
class_abstraction
Instantiating content class attribute0.00000.0027180.0000
General
dbfile0.00080.0561160.0001
String conversion0.00000.000540.0000
Note: percentages do not add up to 100% because some accumulators overlap

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
13content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
25content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
14content/datatype/view/ezxmltags/literal.tpl<No override>extension/community/design/standard/templates/content/datatype/view/ezxmltags/literal.tplEdit templateOverride template
7content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
5content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 66
 Number of unique templates used: 7

Time used to render debug report: 0.0001 secs