Forums / Developer / I can't use user parameters on templates
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 advanceAdolfo 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