how to set value of array item?

Author Message

Vytautas Germanavičius

Tuesday 10 October 2006 5:00:16 am

i need to chage value of one item of array.
I tried something like :

{set $items[0]=100}

But it shows syntax error ...

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

Paul Forsyth

Tuesday 10 October 2006 5:07:58 am

The last i tried this couldnt get this to work.

Instead I found i had to remove/append the item to make it set, which is horrible.

Paul

Vytautas Germanavičius

Tuesday 10 October 2006 6:01:05 am

Should i fill fearture request form?

Because to replace several itmes in big array with remove/append is too much time consuming.

At the moment, i use my own written operator... I'm not sure that this is best way...

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

Marius Eliassen

Tuesday 10 October 2006 6:25:07 am

You can try something like

{set $items=$items|remove( 0,1 )|insert( 0,100 )}

Claudia Kosny

Wednesday 11 October 2006 12:37:14 am

Hello vytis

an enhancement request sounds like a good idea to me. For the moment I use my own array operators as well and they work fine.

Greetings from Luxembourg

Claudia

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