Forums / Setup & design / menu and submenu

menu and submenu

Author Message

Marcin N.

Tuesday 12 December 2006 12:25:12 am

Hi!

I have menu (folders). Now I try to build submenu (folders). Menu and submenu are placed separate in diffrent parts of site. When you click menu item then you get site with submenu (kind of context submenu) for clicked item (just one level depth nothing more).
Now I used this standard code:

{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=1}
        <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}

..but it doesn't work as I want. It shows whole structure (I want items on the second level) and it doesn't change when I click main menu :/
'll be thankful for tips examples etc. ...!?

Marcin

Marcin N.

Tuesday 12 December 2006 4:06:32 am

I started again with much more simple code:

{def $mainMenu=treemenu( $module_result.path, $module_result.node_id, , 1, 3 ) }

{foreach $mainMenu as $menu}

<li class="level_{$menu.level}">
 
    {if $menu.is_selected}
        <div class="selected">
        <a href={$menu.url_alias|ezurl}>{$menu.text}</a>
        </div>
    {else}
        <a href={$menu.url_alias|ezurl}>{$menu.text}</a>
    {/if}
</li>

{/foreach}

{undef $mainMenu}

It works BUT...my submenu doesn't change when I click main menu item :(

Marcin N.

Tuesday 12 December 2006 5:58:50 am

I put my submenu code in cache-block:

{cache-block keys=$module_result.node_id}
...
{/cache-block}

... but still nothing

Claudia Kosny

Wednesday 13 December 2006 12:29:41 pm

Hi Marcin

Could you give an example what you want to accomplish and what the structure of the site is? Example:
Structure of the site:
-mainfolderA
--subfolderA1
--subfolderA2
--subsubfolderA2i
--subsubfolderA2ii
--subsubfolderA2iii
--subfolderA3
-mainfolderB
--subfolderB1
--subfolderB2
-mainfolderC
--subfolderC1
--subfolderC2
--subfolderC3

The menu on the main page should look like:
...

and when clicking on mainfolderA, the menu should look like:
...

Claudia

Marcin N.

Thursday 14 December 2006 12:33:25 am

Thanks for help!
I found solution here:
http://ez.no/community/forum/setup_design/new_menu
there is my answer.

Marcin

eZ debug

Timing: Jan 18 2025 14:56:43
Script start
Timing: Jan 18 2025 14:56:43
Module start 'content'
Timing: Jan 18 2025 14:56:43
Module end 'content'
Timing: Jan 18 2025 14:56:43
Script end

Main resources:

Total runtime0.1880 sec
Peak memory usage2,048.0000 KB
Database Queries141

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0076 588.7422180.8438
Module start 'content' 0.00760.0062 769.585997.8516
Module end 'content' 0.01390.1741 867.4375528.2500
Script end 0.1879  1,395.6875 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00392.0598200.0002
Check MTime0.00150.7918200.0001
Mysql Total
Database connection0.00070.392510.0007
Mysqli_queries0.135972.29941410.0010
Looping result0.00150.79671390.0000
Template Total0.173792.410.1737
Template load0.00090.486010.0009
Template processing0.172891.916910.1728
Override
Cache load0.00060.343010.0006
Sytem overhead
Fetch class attribute can translate value0.00130.713810.0013
XML
Image XML parsing0.00030.144210.0003
General
dbfile0.00643.3982200.0003
String conversion0.00000.004230.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
1pagelayout.tpl<No override>extension/sevenx/design/simple/templates/pagelayout.tplEdit templateOverride template
 Number of times templates used: 1
 Number of unique templates used: 1

Time used to render debug report: 0.0001 secs