[TYPO3-english] includeCSS order

Jigal van Hemert jigal at xs4all.nl
Sat Dec 24 16:13:51 CET 2011


Hi,

On 24-12-2011 10:47, Wenzel Dirk wrote:
> Searching the web I got inconsistent statements. Some posts claim the
> order of inclusion to be controllable by numbering. But an earlier
> post by Dmitri Dulepov at this list (June 2008:
> http://lists.typo3.org/pipermail/typo3-english/2008-June/050561.html)
> says:
>
>> The inclusion order is not defined if you use
>> includeJS/includeCSS.
>
>>> How can I control the order of includes?
>>
>> Use page.headerData instead.
>
> And here are my questions:
> 1. Is Dmitris statement still valid for current versions (4.5 or
> 4.6)?

No, not completely. You can now use:
includeJSlibs (with sub-properties .allWrap and .external)
includeJSFooterlibs (same sub-properties)
includeJS (sub-properties .type, .compressed, .forceOnTop, .allWrap and 
.external)
includeJSFooter (same sub-properties as includeJS)

The parts in *libs are rendered before the others. the .forceOnTop 
sub-property adds the item on the top of the list instead of on the 
bottom. Note that multiple .forceOnTop will result in an order where the 
first item with .forceOnTop will not end up really on top. At least you 
can control a list of items you add for a large part.

 > 2. Why is the order undefined?
> Since the order of CSS and JS does matter for the page rendering one
> should be able to control it. To put it bluntly: An instruction which
> produces an undefined order seems pretty useless to me.

Compare this to an SQL statement: if you don't specify a sort order it 
will be retrieved in an undefined order. So, today it may very well be 
in a different order than the list of records you retrieved yesterday.

Why is the order undefined? Simply because the items are not sorted in 
any way. All the operations which are performed before the end result is 
created do not look at any order. With the new options to influence the 
order to a certain degree, most (if not all) situations can be solved.

-- 
Kind regards / met vriendelijke groet,

Jigal van Hemert.


More information about the TYPO3-english mailing list