[Typo3] headerData loaded with ext?

Dmitry Dulepov typo3 at fm-world.ru
Wed Aug 24 09:57:34 CEST 2005


Hi!

If you prefer TypoScript:
----------------
Write that in the TS setup of your extension. Choose some random number
(53 will also work).

The only problem is that one may want to call page differently than
"page" but it is really rare...

If you want to avoid difficulties above and hard-code it in extension:
----------------
Use $GLOBALS['TSFE']->additionalHeaderData array like this:
	$GLOBALS['TSFE']->additionalHeaderData['tx_yourext_pi1'] =
		'<script src="path_to_script.js"></script>';

You can also put script directly on the page (which is worse since
creates more web traffic for your site) using
$GLOBALS['TSFE']->additionalJavaScript['tx_yourext_pi1']

Dmitry.

Georg Ringer wrote:
> Hi,
> 
> I need to load a javascript file into the header at my new extension and I 
> don't know how I can do this.
> I don't want to tell the user to write the following lines into the Setup:
> page.headerData.53 = TEXT
> page.headerData.53.value= <script language="JavaScript" 
> src="typo3conf/........js"></script
> 
> Can somone help me out?
> would be great
> thanks!
> georg 
> 
> 



More information about the TYPO3-english mailing list