[TYPO3-dev] Preventing JavaScript from Being included twice

Xavier Perseguers typo3 at perseguers.ch
Tue Dec 30 13:20:19 CET 2008


Hello,

In Dmitry's book there is a hint (IIRC) that appeared once too on this 
list or the English one, I don't remember:

Basically the idea is to use a key for the additionalHeaderData instead 
of just appending it to the end of the list of scripts to be included:

$GLOBALS['TSFE']->additionalHeaderData['MD5_script'] = '<script 
type="text/javascript" src="typo3/md5.js"></script>';

You may test too that the key does not exist already. If the same key is 
used all over the sources, you ensure that the script won't be included 
twice and you don't have to start adding additional config stuff and let 
the "end-user" play with them until it works.

HTH

-- 
Xavier Perseguers
http://xavier.perseguers.ch/en

One contribution a day keeps the fork away




More information about the TYPO3-dev mailing list