[TYPO3-mvc] footer equivalent for addAdditionalHeaderData

Kerstin Eitner eitner.kerstin at googlemail.com
Wed Nov 23 15:29:07 CET 2011


Hi Tim, hi Sebastian,

thanks a lot for the hints and the explications!
I will check that as soon as possible.

Greets,
Kerstin



Am 22.11.2011 15:05, schrieb Tim Schoch | GSTALTIG:
> Hi Kerstin
>
> I guess you missunderstoud my text.
> You set the var inside your template. The js file you add in your TypoScript template then makes use of it.
> The trick is that if you declare it in the global namespace, you can use it everywhere. Place this in your fluid template:
> <script>var extkey_autoplay = {autoPlay}</script>
>
> now create a js file with the jquery stuff in it and add it in your setup.txt:
> page.includeJsFooter.extkey = EXT:extkey/Resources/Public/Javascript/jquery.slider.js
>
> and inside that jquery.slider.js you put this:
> jQuery(document).ready(function(){
>      // you dont need the uid if place the slider only once
>    jQuery("#slider").start({autoPlay: extkey_autoplay});
> });
>
> You can optimize this in some ways by storing the settings in a namespace inside the window object (registry pattern) or allowing multiple instances on one page.
>
> Personally I prefere this way over the one Stephen suggested, because the javascript code is separated from the rest. Same principle as why you separate the view from the controller. But at the end it all depends on your personal opinion and what you want to achieve.
>
> Tim



More information about the TYPO3-project-typo3v4mvc mailing list