Display small icon when an object has child-objects

Author Message

willy jansen

Tuesday 28 September 2004 11:35:59 am

Hi,

In my menu I'd like to add a small icon (e.g. the PLUS sign) to a menu-item when that item has sub-items... in other words: when the object has child-objects. In that case a user knows that the menu expands when he clicks on the menu item.

How could I achive that?

The menu I'm using is:

{let docs=treemenu( $module_result.path, 
                    $module_result.node_id,
                    array('folder','article'), 1, 2 )
                    depth=1}

        <ul>
        {section var=menu loop=$:docs last-value}
            {section show=and($menu.last.level|gt($menu.level),$menu.number|gt(1))}

           </ul>
           </li>
           {/section}
            <li>
            {section show=and($menu.last.level|lt($menu.level),$menu.number|gt(1))}
            <ul>
               <li>
            {/section}

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

           </li>
        {/section}
        </ul>

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

        {/let}

willy jansen

Tuesday 09 November 2004 7:37:38 am

I now use the (ugliest of all solutions): I check what the id of the node that is shown in the menu is and place a "plus" sign before... :'( ... the best I could come up with

did anybody implement a more elegant solution?

{let docs=treemenu( $module_result.path, 
                    $module_result.node_id,
                    array('folder'), 2, 2 )
                    depth=1}

        {section var=menu loop=$:docs last-value}
            {section show=and($menu.last.level|gt($menu.level),$menu.number|gt(1))}

           </ul>
           </li>
           {/section}
            <li>
            {section show=and($menu.last.level|lt($menu.level),$menu.number|gt(1))}
            <ul>
               <li>
            {/section}

            {set depth=$menu.level}


{* $menu|attribute(show) *}

{section name=plus show=$menu.id|eq(117)}+{/section}
{section name=plus show=$menu.id|eq(118)}+{/section}
            <a {$menu.is_selected|choose('','class="selected"')}
                href={$menu.url_alias|ezurl}>{$menu.text|shorten(35)}</a>

           </li>
        {/section}
        </ul>

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

        {/let}

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