Re: passing an array to an included template
| From: | Jens Lehmann | Date: | Thu, 02 May 2002 08:45:00 +0000 |
| Subject: | Re: passing an array to an included template | ||
| References: | 1 | Groups: | php.smarty.general |
| Request: | Send a blank email to php-smarty-general+get-3975@lists.php.net to get a copy of this message | ||
I had a further look at the source-code because there
seems to be no nice solution for this problem. I changed
_parse_attrs in Smarty_Compiler.class.php, so that a
token is not automatically quoted if there are no quotes
set by the user. I can now pass an array to an included
template.
This solution forces people to quote arguments and I'm
not really sure if this is a good solution, because you still
need the "array"-keyword which is PHP and not
Smarty-Syntax.(?)
Any thoughts?
Jens
> I want to do something like the following statement:
>
> {include file="foo.tpl" some_array = array('foo1','foo2') }
>
> It doesn't work to pass an array to the included template
> this way because the compiled template will loke like:
>
> $this->_smarty_include("foo.tpl", array( 'some_array' =>
> "array('foo1','foo2')" ) );
>
> Is there an other possibilty for achieving this? I can't
> declare the array in my PHP-Code.
>
> By the way: How can I see which variables are known
> in an included template? The Debug-Console imho doesn't show
> this by default.
>
> Jens
>