Thursday 24 April 2003 6:25:50 am
As the template engine is today all reads are done using the root namespace of the file while writes are using the current namespace. To overcome the problems you have to move the namspace as Sergey noted. Future versions of the template engine will probably support namespace declarations in function input variables as well as relative namespace references.
Some examples:
{set #:found_something=1}
sets the found_something variable in the root namespace
{set ..:found_something=1}
sets the found_something variable one namespace up
{$..:found_something} Accesses the found_something variable one level up from the current namespace
Also another way to use section would help out, something like:
{section variable=i loop=$items}
{$:i.key} - {$:i.item.name}
{section variable=j loop=$:i.item.children}
{$:j.item}
{/section}
{/section} Here the template loop variables are set as an hash array in the current namespace.
Last a new way to do if/else-if/else style checks.
{section show=eq($a,$b)}
{section-else show=eq($a,$c)}
{section-else show=eq($a,$d)}
{section-else} {/section} Nothing has been decided yet so please come with suggestion for things you would like to see in the template engine (not just namespaces).
--
Amos
Documentation: http://ez.no/ez_publish/documentation
FAQ: http://ez.no/ez_publish/documentation/faq
|