[PHPTAL] Weird behavior with the structure in attributes

Laurent Bedubourg lbedubourg at motion-twin.com
Tue Sep 26 16:45:42 CEST 2006


Levi Stanley wrote:
> I am getting this error:
> 
> PHP Parse error:  syntax error, unexpected T_CONSTANT_ENCAPSED_STRING, 
> expecting T_STRING or T_VARIABLE or '{' or '$' in 
> /www/sites/____.com/cache/tpl_1_1_74130644086ba9d17308c8593cef4edbc.php 
> on line 181
> 
> It is coming from this line in my template:
> 
> <tr tal:repeat="channel channels">
> <td width="132">
> <a tal:attributes="onmouseover ${structure channel/onmouseover}; 
> onmouseout ${structure channel/onmouseout}" href="#"><img 
> id="pTV_main_42" width="132" height="32" alt="" border="0" 
> tal:attributes="src channel/image"/>
> </a>
> </td>
> </tr>

Hi Stanley,

inside tal:* attributes you do not have to use the ${} syntax.

tal:attributes="
onmouseover structure channel/onmouseover;
onmouseout structure channel/onmouseout
"

${} is to echo things outside tal attributes

<span class="${class}">${content}</span>

It is a convenient shortcut for :

<span tal:replace="XXXX"/>

However, it looks like tal:attributes does not support the structure 
keyword, I will have to fix this...

Instead the following notation should resolve your problem :

<a
onmouseover="${structure channel/onmouseover}"
onmouseout="${structure channel/onmouseout}"
 >bla bla</a>

Regards
Laurent

-- 
Laurent Bedubourg
lbedubourg at motion-twin.com
http://www.motion-twin.com



More information about the PHPTAL mailing list