Forums / Setup & design / new menu

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

eZ debug

Timing: Jan 18 2025 05:01:34
Script start
Timing: Jan 18 2025 05:01:34
Module start 'content'
Timing: Jan 18 2025 05:01:35
Module end 'content'
Timing: Jan 18 2025 05:01:35
Script end

Main resources:

Total runtime1.1001 sec
Peak memory usage4,096.0000 KB
Database Queries226

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0073 591.0625180.8516
Module start 'content' 0.00730.9546 771.9141676.9375
Module end 'content' 0.96190.1382 1,448.8516348.4609
Script end 1.1001  1,797.3125 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00420.3814210.0002
Check MTime0.00150.1382210.0001
Mysql Total
Database connection0.00110.097610.0011
Mysqli_queries0.999890.87742260.0044
Looping result0.00220.20022240.0000
Template Total1.064996.820.5324
Template load0.00190.174420.0010
Template processing1.062996.617620.5315
Template load and register function0.00010.010710.0001
states
state_id_array0.00100.089310.0010
state_identifier_array0.00130.116620.0006
Override
Cache load0.00180.1596770.0000
Sytem overhead
Fetch class attribute can translate value0.00120.113640.0003
Fetch class attribute name0.00140.1281140.0001
XML
Image XML parsing0.00100.094540.0003
class_abstraction
Instantiating content class attribute0.00010.0047180.0000
General
dbfile0.00760.6877270.0003
String conversion0.00000.000430.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
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
1pagelayout.tpl<No override>extension/sevenx/design/simple/templates/pagelayout.tplEdit templateOverride template
 Number of times templates used: 66
 Number of unique templates used: 7

Time used to render debug report: 0.0002 secs