[TYPO3-core] RFC: Load javascript libraries
Martin Kutschker
Martin.Kutschker at n0spam-blackbox.net
Wed Sep 19 18:13:24 CEST 2007
Oliver Hader schrieb:
>
> But I wouldn't put this to
> template.php but more to t3lib_div. The libs could also be used for
> front-end disposal - so putting this to template.php has no effect in
> that case.
No, t3lib_div is and should be ignorant of any rendering context. IMHO BE
and FE differ quite well in the way they generate HTML code.
> Another thing is, that there are some extensions in the TER which have
> some JavaScript library inside (e.g. extension "scriptaculous"). So, it
> might be possible that different scripts do the following:
>
> loadJavaScriptLib('contrib/prototype/prototype.js');
> loadJavaScriptLib('contrib/scriptaculous/scriptaculous.js');
> loadJavaScriptLib('typo3conf/scriptaculous/lib/prototype.js');
> loadJavaScriptLib('typo3conf/scriptaculous/src/scriptaculous.js');
>
> With an approach storing the filepath, all files would be integrated
> together. A better one would be to extract and store only the filename,
> e.g. 'prototype.js', of the library to be loaded.
And which would get loaded? It's controllable for us which prototype
version the Core and the sysexts require, but a TER version might reuqire
another one and use/ship that on purpose.
So I'm fine with a JS loader in template.php or maybe t3lib_BEfunc for the
BE. An FE loader should work differently because of the difficulties you
mention. Eg it could use tha basename as index and issue a TT warning/error
when a second request for a lib uses a different path.
Masi
More information about the TYPO3-team-core
mailing list