Forums / Setup & design / Help with horizontal looper code

Help with horizontal looper code

Author Message

steve walker

Tuesday 09 March 2004 12:10:44 pm

Hi,

I am creating a horizontal subnavigation looper, similar to the type used on the Ez site. The code I have to create sub nav " subnav1 | subnav2 | ..etc" is:

{let mainMenu=treemenu($module_result.path,$module_result.node_id,array('folder','info_page'), 1 )} {section name=Menu loop=$mainMenu}
{section show=$:item.is_selected}

{/section} <a href={$:item.url_alias|ezurl}>{$Menu:item.text}</a>
{section show=$:item.is_selected} {/section}   |   {/section}
{/let}

The problem is that the last loop adds the "|" seperator - so I end up with an ugly " subnav1 | subnav2 | subnav3 |" ..I dont want that last "|"!

Presumably need to put somethnig in the loop saying "if this is the last loop, dont print |" but I'm not that good a coder.

Anyone out there now how to tweak this?

Thanks, Steve

http://www.oneworldmarket.co.uk

Paul Borgermans

Tuesday 09 March 2004 12:48:53 pm

{let mainMenu=treemenu($module_result.path,$module_result.node_id,array('folder','info_page'), 1 )} {section name=Menu loop=$mainMenu}
{section show=$:item.is_selected}

{/section} <a href={$:item.url_alias|ezurl}>{$Menu:item.text}</a>
{section show=$:item.is_selected} {/section}{delimiter}   |  {/delimiter} {/section}
{/let}

see

http://ez.no/ez_publish/documentation/reference/template_functions/program_flow/section

-paul

eZ Publish, eZ Find, Solr expert consulting and training
http://twitter.com/paulborgermans

steve walker

Tuesday 09 March 2004 1:08:10 pm

Paul,

Thankyou very much. Steve

http://www.oneworldmarket.co.uk

ashok ashok

Monday 19 April 2004 1:54:48 am

I am very new to ezpublish. I was jut trying to understand the following code.

 <div id="submenu">
        <div class="design">
            <h3 class="invisible">Sub menu</h3>
            <ul>
                {let mainMenu=treemenu($module_result.path,$module_result.node_id,array('folder','info_page'), 1 )}
                    {section name=Menu loop=$mainMenu}
            	    {section show=$:item.is_selected}
            
                        {/section}
            
                        <li class="level_{$:item.level}">
                           <a href={$:item.url_alias|ezurl}>{$Menu:item.text}</a>
                        </li>
            
            	    {section show=$:item.is_selected}
            
                        {/section}
                    {/section}
                {/let}
            </ul>
        
        </div>
    </div>

I understood that this code is loop which displays the link.i.e {let mainMenu=treemenu($module_result.path,$module_result.node_id,array('folder','info_page'), 1 )}
But i have not understood the follwing code in it i.e

{section show=$:item.is_selected}
{/section}

. Removed this code from both the places but still it works fine. Please any one can tell me why this code is written and what is the purpose of this code or please tell me the exact working of the full code.
Thanks In advance
Ashok Naidu