[TYPO3-english] Inlcuding javascripts in bottom

Christopher Torgalson bedlamhotel at gmail.com
Tue Jun 8 20:48:39 CEST 2010


Hello,

On Tue, Jun 8, 2010 at 10:38 AM, Steffen Gebert
<steffen at steffen-gebert.de> wrote:
> Am 08.06.2010, 13:45 Uhr, schrieb Bing van Moorsel | Idar Creative
> <bing at idar.nl>:
>
>> Thanks Both but the addJsFooter() is from 4.3.x im using 4.2.12
>> is there an other way to do this instead of addJsfooter()?
>>
>> $GLOBALS['TSFE']->getPageRenderer()->addJsFooter($tets)
>>
>> Doesn't work (where $test is the javascript)
>> And i dont want to include trough typoscript but in the php file.
>>
>> any suggestions?
>
> Upgrade to 4.3 ;-)
>
> Otherwise you only have the dirty way (which some other extensions go) to
> str_replace() </body>.


This is not strictly true. If you're willing to add all JS files to
the page source by hand (i.e. with TS), you can exploit the fact that
the PAGE object has .stdWrap properties:


page = PAGE
page {
  stdWrap.append = COA
  stdWrap.append {
    10 = TEXT
    10.value = <script type="text/javascript"
src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.2/jquery-ui.min.js"></script>
  }
}


This is a bit of a headache with a site where the libraries vary a lot
from page to page (lots of conditions, 'if', or CASE etc required...),
but if the JS requirements are simple, it's quite simple to do.


-- 
Christopher Torgalson
http://www.typo3apprentice.com/


More information about the TYPO3-english mailing list