Forums / General / Pls explain namespace concept in sections

Pls explain namespace concept in sections

Author Message

SathishKumar Subramanian

Saturday 13 December 2003 2:06:34 am

Hi,

I am strucking in the namespace concept while using more than one "sections" and "let". I cant get the solution to findout the problem because of namespace. Pls explain the namespace concept in sections.

Thanx in Advance :)

Sathizh

Georg Franz

Saturday 13 December 2003 6:34:21 am

Hi Sathizh,

have a look at http://ez.no/developer/ez_publish_3/documentation/development/libraries/ez_template/basics/namespaces_

But using Namespaces give you more troubles than not using them. (I've wasted a lot of hours to find that out.)

The main problem of the Namespace-Feature: You can't set global variables in a nested namespace.

Expample:

{let name=myglobalnamespace
first=true()
}
{section name=mysection loop=7}
{section name=mysubsection show=$myglobalnamespace:first}
{set first=false()}
{/section}
{/section}
{/let}

-> Setting $first to "false" won't work, because the parser looks for the variable "$myglobalnamespace:mysection:mysubsection:first" which doesn't exist.

And - a main lack of ez - you can't using the set-function with Namespaces.

{set myglobalnamespace:first=false()} produces an error.

So, only use Namespaces, if you don't want to set variables in a Subnamespace.

Kind regards,
Emil.

Best wishes,
Georg.

--
http://www.schicksal.com Horoskop website which uses eZ Publish since 2004

Lazaro Ferreira

Sunday 25 January 2004 2:01:25 pm

Hi,

I have to agree with you, this namespaces features could be a real nigthmare for an ezpublish template beginner

What a pity for reading your post so late, after wasting lot of time thinking how to set a global or outer namespace variavel in a nested namespace

The bad thing about this, is that it doesn't appear docummented in namespace documentation

 

Lazaro
http://www.mzbusiness.com

Paul Borgermans

Monday 26 January 2004 4:20:27 am

Hi

You can set global variables, study the example below and try it out:

{let a=3
      b=array(1,2,3,4,5)}
{section name=test loop=$b}
{let a=$test:item}
<p>local a={$test:a}, global a={$a}</p>
{set-block scope=root variable=a}{$test:a}{/set-block}
<p>again after set-block, local a={$test:a}, global a={$a}</p>
{/let}
{/section}
{/let}

If you think this is useful, buy me a beer at the next summer conference and buy the book on ezp when it comes out

-paul

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