I can't use user parameters on templates

Author Message

Adolfo Barragán

Friday 18 August 2006 3:03:47 am

Just as documentation of "node_view_gui" says, I can pass user parameters to template. However this code don't work. Why?

Template 1

...
{foreach $list_items as $child sequence=array( 'bglight', 'bgdark') as $style}
    {node_view_gui view=line content_node=$child style=$style}
{/foreach}
....

Template 2 (line view)

...  
<div class="content-view-line {$style}">  
...

In this template <i>$style</i> is empty, because in browser I get:

...
<div class="content-view-line ">
...

Thanks in advance
Adolfo Barragán

Claudia Kosny

Friday 18 August 2006 6:49:47 am

Hi Adolfo,

You just have a small mistake in your code, there should be no equal sign between the words sequence and array.
So the correct code is:

{foreach $list_items as $child sequence array( 'bglight', 'bgdark') as $style}
   {node_view_gui view=line content_node=$child style=$style}
{/foreach}

If something like this happens again, first have a look at the debug output. Although the messages are sometimes quite cryptic you still can usually see in which line an error occurs.

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 18:42:27
Script start
Timing: Jan 18 2025 18:42:27
Module start 'layout'
Timing: Jan 18 2025 18:42:27
Module start 'content'
Timing: Jan 18 2025 18:42:27
Module end 'content'
Timing: Jan 18 2025 18:42:28
Script end

Main resources:

Total runtime0.0149 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.0050 588.0469152.6406
Module start 'layout' 0.00500.0030 740.687539.4766
Module start 'content' 0.00810.0049 780.164189.3828
Module end 'content' 0.01300.0019 869.546930.3047
Script end 0.0149  899.8516 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.002415.8521140.0002
Check MTime0.00117.3241140.0001
Mysql Total
Database connection0.00075.009210.0007
Mysqli_queries0.003019.835130.0010
Looping result0.00000.080010.0000
Template Total0.001510.010.0015
Template load0.00085.599910.0008
Template processing0.00074.392910.0007
Override
Cache load0.00063.760510.0006
General
dbfile0.00117.077680.0001
String conversion0.00000.052840.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