[Typo3-dev] Error including JS in headerData
Peter Russ
peter.russ at 4many.net
Sun May 1 13:45:01 CEST 2005
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 < 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.';
Regs. Peter.
More information about the TYPO3-dev
mailing list