[TYPO3-dev] Including files to the <head> once

ries van Twisk typo3 at rvt.dds.nl
Sat Jan 3 00:23:04 CET 2009


On Jan 2, 2009, at 6:12 PM, Xavier Perseguers wrote:

> 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.
>


Why not make a function call for this, rather then direct array access?

Ries











More information about the TYPO3-dev mailing list