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.

eZ debug

Timing: Jan 18 2025 22:31:22
Script start
Timing: Jan 18 2025 22:31:22
Module start 'layout'
Timing: Jan 18 2025 22:31:22
Module start 'content'
Timing: Jan 18 2025 22:31:22
Module end 'content'
Timing: Jan 18 2025 22:31:22
Script end

Main resources:

Total runtime0.0198 sec
Peak memory usage2,048.0000 KB
Database Queries3

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0058 589.0313152.6250
Module start 'layout' 0.00590.0036 741.656339.4453
Module start 'content' 0.00940.0084 781.101693.4453
Module end 'content' 0.01780.0020 874.546934.3047
Script end 0.0198  908.8516 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.002412.0058140.0002
Check MTime0.00105.2609140.0001
Mysql Total
Database connection0.00115.461910.0011
Mysqli_queries0.003115.579230.0010
Looping result0.00000.096310.0000
Template Total0.00157.610.0015
Template load0.00084.104210.0008
Template processing0.00073.508510.0007
Override
Cache load0.00062.836910.0006
General
dbfile0.00021.126680.0000
String conversion0.00000.049340.0000
Note: percentages do not add up to 100% because some accumulators overlap

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 1
 Number of unique templates used: 1

Time used to render debug report: 0.0001 secs