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