Re: [SMARTY-DEV] block functions
| From: | Andrei Zmievski | Date: | Thu, 04 Apr 2002 18:04:36 +0000 |
| Subject: | Re: [SMARTY-DEV] block functions | ||
| References: | 1 | Groups: | php.smarty.dev |
| Request: | Send a blank email to php-smarty-dev+get-25@lists.php.net to get a copy of this message | ||
On Thu, 04 Apr 2002, Andreas Kossmeier wrote:
> hi,
>
> i've just tried the new block functionality in the latest snapshot. for
> simple block function (e.g. translation, etc.) it's working fine, but
> take a look at a possible table block function:
>
> :
> :
> {table cols=4 from=$data item=td}
> :
> this is ID {$td.ID} of {$td.name}
> :
> {/table}
> :
>
> the block function has only access to the eval'd body of the block, so
> looping over data will not be possible. even if there is access, this
> solution wouldn't be clean. IMO a compiler part for the body of the
> block function could do the job, so why not introducing the possibility
> of processing the body at compile time?
What do you mean? The body *is* processed at compile time, it is
compiled into PHP code which is evaluated at run-time and passed to the
block function.
I know what you want to achieve, but not sure of a good way to do it.
It seems that the block function would need to receive compiled code as
its content so that it could loop and call eval() on the code when
needed..
-Andrei
* As a child, I wanted to know everything. Now I miss my ignorance. *