using arrays -> help needed

Author Message

Georg Franz

Wednesday 09 July 2003 9:29:56 am

Hi folks,

I have many related objects at an article. I want to show them in different places at the article page.

So I want to put a related object to one or more different arrays, if a statement is true.

{let main_array = array(1,2,3,2,5,4,2)
new_array = array()}
{section name=test loop=$main_array}
{section show=eq($test:item, 2)}
{set new_array[] = $test:item}
{/section}
{/section}
{/let}

This didn't work. So how could I put a new value at the end of new_array? Is there a array_merge or array_append function?

Kind regards,
Emil.

Best wishes,
Georg.

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

Paul Forsyth

Thursday 10 July 2003 12:57:58 am

Im not sure that you can add to arrays in this way from a template.

What kind of errors are you getting?

Jan Borsodi

Thursday 10 July 2003 6:07:30 am

The template engine does not support appending to arrays with []. Try using array append
{set new_array = $new_array|array_append($test:item)}

See the documentation for arrays for more info
http://ez.no/developer/ez_publish_3/documentation/development/libraries/ez_template/operators/array_handling

--
Amos

Documentation: http://ez.no/ez_publish/documentation
FAQ: http://ez.no/ez_publish/documentation/faq

Georg Franz

Monday 14 July 2003 4:22:14 am

thanx for the info and the new documentation!

Kind regards,
Emil.

Best wishes,
Georg.

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

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 19 2025 00:21:38
Script start
Timing: Jan 19 2025 00:21:38
Module start 'layout'
Timing: Jan 19 2025 00:21:38
Module start 'content'
Timing: Jan 19 2025 00:21:38
Module end 'content'
Timing: Jan 19 2025 00:21:38
Script end

Main resources:

Total runtime0.0249 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.0049 587.9141152.6250
Module start 'layout' 0.00490.0043 740.539139.4453
Module start 'content' 0.00910.0134 779.984493.3203
Module end 'content' 0.02250.0024 873.304734.3047
Script end 0.0249  907.6094 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.002610.4089140.0002
Check MTime0.00114.5003140.0001
Mysql Total
Database connection0.00072.830810.0007
Mysqli_queries0.002811.331730.0009
Looping result0.00000.096710.0000
Template Total0.00177.010.0017
Template load0.00083.365010.0008
Template processing0.00093.637810.0009
Override
Cache load0.00062.368410.0006
General
dbfile0.005421.553080.0007
String conversion0.00000.036440.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