[Typo3-dev] Error including JS in headerData

Peter Russ peter.russ at 4many.net
Sun May 1 13:56:12 CEST 2005


Peter Russ wrote:

> Michael Scharkow wrote:
> 
>> Hi,
>>
>> I need to dynamically place JS code in the page header within a fe 
>> plugin, like this
>>
>> $GLOBALS['TSFE']->pSetup['headerData.'][$levelHeaderData.'.']['value'] 
>> = $jsCode;
>>
>> The problem is that $jsCode contains a line like
>> for(var i=0; i<document.bla...
>>
>> and the less-than sign seems to break the rendering of the page header 
>> because the following code is rendered like this
>>
>> ifdocumenttx_mssurvey_pi1_surveyformtx_mssurvey_pi1colorichecked="true){" 
>> errormessagepop="" break="" iferrormessagelength="0)"
>>
>>
>> I tried using &lt; but this is rendered verbatim, so I'm completely at 
>> loss.
>>
>> Hints, workarounds (like on how to write a for loop without < or >) 
>> are appreciated. BTW, I'm using the latest beta...
>>
>> Greetings,
>> Michael
> 
> Would this help:
> instead of using '<' replace with .chr(60).
> ?
> So your $jsCode would look like:
> $jsCode='for(var i=0; i'.chr(60).'<document.element.';
> 
$jsCode='for(var i=0; i'.chr(60).'document.element.';
  ;-)




More information about the TYPO3-dev mailing list