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

Steffen Kamper info at sk-typo3.de
Mon Feb 2 23:21:24 CET 2009


Hi Ingo,

Ingo Renner schrieb:
> Steffen Kamper wrote:
> 
> PHP wise I would suggest the following:
> 
> create a class to represent a page: $page
> 
> $page->addCssFile(
>     $pathToFile,
>     [$blockPosition,] (defaults to xxx, defined as constants)
>     [$additionalAttributes = 'predefined defaults']
> )
> 
> $page->addInlineCss(
>     $cssString
>     $blockPosition,
>     $additionalAttributes
> )
> 
> your identifier can be created automatically, hashing the file path f.e. 
> and doesn't need to be something the user needs to deal with.
> 
> The thing would the look similar for JS.
> 
> Internally it could then work like Dmitry described it. With the 
> introduction of such an API we could also mark the direct access to 
> additionaHeaderData as deprecated, two versions later we can then remove 
> it and thus enforce the use of the API and thus also a standard way of 
> adding JS and CSS to a page.
> 
> 

good idea ;-)

These classes should be usable for BE and FE, so same approach.
It also would simplify the template.php and tslib_pagegen, and would 
allow internal magic like minify, double inclusion checks etc.

vg Steffen




More information about the TYPO3-dev mailing list