[TYPO3] Adding JavaScript from TypoScript template
Christopher
bedlamhotel at gmail.com
Wed Oct 4 16:40:24 CEST 2006
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
More information about the TYPO3-english
mailing list