[TYPO3] Adding JavaScript from TypoScript template
Ricardo Pereira
ricardo at tdwg.org
Wed Oct 4 18:26:33 CEST 2006
Yes, it works as advertised. Many thanks, folks!!
Christopher wrote:
> Hello,
>
> On 10/4/06, Dmitry Dulepov <dmitry at typo3.org> wrote:
>
>> Hi!
>>
>> Ricardo Pereira wrote:
>>
>>> How can I add some JavaScript to the head section of a web page from
>>> a TypoScript template? More specifically I want to add this code:
>>>
>>> <script type="text/javascript">
>>> <!--
>>> fireOnload( function() {
>>> restoreTreeState("nav","pageUid123");
>>> });
>>> //-->
>>> </script>
>>>
>>> In the case above, the string 123 (in pageUid123) is to to be
>>> replaced by the page UID of the current page.
>>>
>> Not possibl to add such thing to head without extension. However you can
>> add this inside <body> with simple HTML object.
>>
>>
>
> Huh?
>
> What about this:
>
> page.headerData.50 = HTML
> page.headerData.50 {
> value.data = field:uid
> value.wrap = <script type="text/javascript"><!-- fireOnload(
> function() { restoreTreeState("nav","|"); }); //--></script>
> }
>
> Tested and working.
>
>
> -Christopher
> _______________________________________________
> TYPO3-english mailing list
> TYPO3-english at lists.netfielders.de
> http://lists.netfielders.de/cgi-bin/mailman/listinfo/typo3-english
>
>
More information about the TYPO3-english
mailing list