[PHPTAL] right side expression evaluated using left side variable
devel.php at gmail.com
Thu Apr 16 08:07:10 CEST 2009
It looks like
<tal:block tal:define="label preferences/label|label" tal:replace="structure
result in a null value for variable label if preferences/label is not
defined, even if label is defined.
The problem comes from the generated code which looks like
if (($ctx->label = phptal_path($ctx->preferences, 'label', true)) !==
elseif (($ctx->label = $ctx->label) !== null): ;
This might not be a bug but the right side expression should be evaluated
first before assignment.
A quick workaround would be to do something like
<tal:block tal:define="xlabel preferences/label|label;label xlabel;"
which works, but looks pretty ugly especially if you have lots of variables
to define in tal:define attribute.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the PHPTAL