sorry, I overlooked your answer here.

I was using PHPTal in default output mode, I was not specifying
anything. I'm now specifying
$phpTal->setOutputMode(PHPTAL::XHTML);

My templates have doctype xhtml 1.0


Adding the /*<![CDATA[*/ … /*]]>*/ works fine (adding <!-- --> too, at
least in FF)


thx!



> On 02-09-2009 at 14:04:15 GRolf <ger...@pictureparking.com> wrote:

>> I'm using a <tal:block fill-slot="script"> to fill my macro template with
>> javascript code. However, all < are converted to $lt;, which (seems
>> to) cause an error in a for loop
>>
>> for (i=0; i < myarray.lenght; i++) {
>>  ...
>> }
>>
>> is converted to
>>
>> for (i=0; i &lt; myarray.lenght; i++) {
>>  ...
>> }
>>
>> and I get an error at that line.

> Apparently you're using text/html mode. Do you use HTML 5 output mode or
> XHTML?


> XHTML requires < to be escaped as &lt; (otherwise it would be ill-formed
> start of a tag).

> HTML requires the opposite - it has hardcoded rule that <script> content
> is CDATA where entities aren't interpreted.


>> Any way to enforce phptal to put the content from the <tal:block> to
>> be passed as text ?

> Strictly speaking it is passed as text, and text in markup has to be  
> escaped.

> Try wrapping script in fill-slot in /*<![CDATA[*/ … /*]]>*/. That is a
> workaround for XHTML served as HTML.



_______________________________________________
PHPTAL mailing list
PHPTAL@lists.motion-twin.com
http://lists.motion-twin.com/mailman/listinfo/phptal

Reply via email to