Forums / Developer / cannot set variables inside {section ...

cannot set variables inside {section ...

Author Message

Vytautas Germanavičius

Tuesday 28 March 2006 2:25:49 am

What is wrong with my code?

{set-block scope=root variable=cache_ttl}0{/set-block}
{let path_item_text='aaa'}
{section name=Path loop=$module_result.path}
	{set $path_item_text=$Path:item.text}
	{set $path_item_text=$path_item_text|shorten(25)}
	    {section show=$Path:item.url}
	        {section show=is_set($Path:item.url_alias)}
	            <a href={$Path:item.url_alias|ezurl}>{$path_item_text}</a> /
	        {section-else}
	            <a href={$Path:item.url|ezurl}>{$path_item_text}</a> /
	        {/section}
	    {section-else}
	        {$path_item_text}{*$Path:item.text|wash*}
	    {/section}
{section-else}
{/section}
{/let}

This code, instead of writing path string, writes "aaa/aaa/aaa/aaa".

It's not possible to set variable inside of section???

{set-block scope=root variable=cache_ttl}0{/set-block}

Łukasz Serwatka

Tuesday 28 March 2006 10:29:37 pm

Try with

{set path_item_text=$Path:item.text}
{set path_item_text=$path_item_text|shorten(25)}

Remove $ sign after {set

Simplier code you can find in design/standard/templates/page_toppath.tpl

Personal website -> http://serwatka.net
Blog (about eZ Publish) -> http://serwatka.net/blog