Forums / Setup & design / Empty treemenu on search result page

Empty treemenu on search result page

Author Message

Aleksander Lech

Tuesday 24 January 2006 5:53:35 am

Hello there,
I'm still having problem with menu generated by treemenu function:

{let docs=treemenu( $module_result.path,
                             is_set( $module_result.node_id )|choose( 2, $module_result.node_id ),
                             array( 1 ),0, 2 )}
{section var=menu loop=$docs}
    {section show=$menu.item.is_selected}
        <div class="level-{$menu.item.level}">
            <div class="selected">
            	<a href={$menu.item.url_alias|ezurl}>{$menu.item.text}</a>
            </div>  
        </div>
        {section-else}
        <div class="level-{$menu.item.level}">
            <a href={$menu.item.url_alias|ezurl}>{$menu.item.text}</a>
        </div>
        {/section}
{/section}
</ul>
{/let}

returns nothing on search result page, and works well everywhere else.

Any idea what's wrong?

Aleksander

André R.

Monday 13 February 2006 7:52:05 am

bacause sort is a system function, just like user/login.

$module_result.path and $module_result.node_id probably returns null / false

eZ Online Editor 5: http://projects.ez.no/ezoe || eZJSCore (Ajax): http://projects.ez.no/ezjscore || eZ Publish EE http://ez.no/eZPublish/eZ-Publish-Enterprise-Subscription
@: http://twitter.com/andrerom

Neidy Tunzine

Tuesday 14 February 2006 2:19:44 am

I had the same problem and i found a solution that works fine for me.
In the template witch calls the search result let's call it pagelayout_search.tpl add the code (in this case we are making the top menu work) :

{let home_path=array( hash('text','Home','url','/content/view/full/2','url_alias','','node_id','2'))}
    {menu name=TopMenu}
{/let}

and in the template with the tremenu function place with the code bellow:

{let docs=treemenu( $home_path, 2, array( 1 ),0, 2 )}
{section var=menu loop=$docs}
   {section show=$menu.item.is_selected}
       <div class="level-{$menu.item.level}">
           <div class="selected">
               <a href={$menu.item.url_alias|ezurl}>{$menu.item.text}</a>
           </div>  
       </div>
       {section-else}
       <div class="level-{$menu.item.level}">
           <a href={$menu.item.url_alias|ezurl}>{$menu.item.text}</a>
       </div>
       {/section}
{/section}
</ul>
{/let}

http://www.mzbusiness.com

Aleksander Lech

Tuesday 14 February 2006 3:28:43 am

Hi Neidy
looks like your solution worked for me :)

Big thanks for suggestion.

Aleksander

Aleksander Lech

Wednesday 15 February 2006 6:53:06 am

Unfortunately - I was to quick tellin' you that it works.

Menu appears on search result page - but it won't expand anymore.

I thought that

{let docs=treemenu( $home_path, 2, array( 1 ),0, 2 )}

means that menu should be build from node_id=2, folders, none ommited and depth=2
but only first level items are shown, and doesn't expand after click on it.
this code (from original flat_left.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=2
                    last_level=0}

expands good but disappears on search result.

Aleksander

Neidy Tunzine

Thursday 16 February 2006 1:46:52 am

The treemenu is better explained by the link bellow:

http://ez.no/doc/ez_publish/technical_manual/3_6/reference/template_operators/miscellaneous/treemenu

Have a nice day.

http://www.mzbusiness.com

Leif Arne Storset

Friday 23 June 2006 9:52:11 am

Although it won't help Lech, Tunzine's solution works fine if you are not using a dynamic (JavaScript) menu.

Leif Arne Storset