[TYPO3-dev] Including files to the <head> once
Xavier Perseguers
typo3 at perseguers.ch
Sat Jan 3 00:12:27 CET 2009
Hi Dmitry!
> The idea is simple. When a developer sets $TSFE->additionalHeaderData[] to '<script src="/path/to/whatever.js"></script>', he should not use just '[]', but he should use a key, which is equal to the name of the included file relative to the TYPO3 root (the directory where t3lib/ is). For example:
>
> $TSFE->additionaHeaderData['typo3/contrib/extjs/ext-base.js'] =
> '<script src="typo3/contrib/extjs/ext-base.js"></script>';
> $TSFE->additionaHeaderData['typo3/contrib/extjs/resources/css/ext-all.css'] =
> '<link rel="stylesheet" href="typo3/contrib/extjs/resources/css/ext-all.css" />';
>
> So if we all try to do it this way, we achieve several goals:
> - we include files once
> - we avoid side effects of multiple file inclusion
> - we minimize page loading time
> - we minimize number of HTTP requests
> - we allow detection of prototype for extensions that use mootools and vice versa
>
> What do you think? Can we make such agreement between us? Should it be included into the next version of CGL as a part of "best practices" or may be even as a direct recommendation?
I think an agreement should be found. Yours is OK for me. Including such
statement as best practice in the next version of CGL would be a good
point as there is somewhere to point out when someone asks for help.
--
Xavier Perseguers
http://xavier.perseguers.ch/en
One contribution a day keeps the fork away
More information about the TYPO3-dev
mailing list