[TYPO3-dev] 4.3 PageIncludes

Sebastian Gebhard sebastian.gebhard at googlemail.com
Fri Oct 30 13:29:34 CET 2009


Thomas "Thasmo" Deinhamer schrieb:
> What about something like this:
> 
> page.includeJS {
>     <name> = fileadmin/holds/the/script.js
>     <name> {
>         implementation = external|inline
>         compression = 0|1
>         position = top|bottom
>         asset/base = 0|1
>     }
> }
> 
> Legend:
> integration....    type of include, external or inline
> compression....    compression for smaller filesize
> position.......    position in the document
> asset or base..    will substitute the file as mandatory (library etc.)

First: I like your idea.

Second: The majority here will want to drop it because we just reworked the includes.

Third: I like your idea. And I think it's still possible to implement.

Fourth: I miss a .order property to define in which order scripts are implemented. If
two scripts have the same .order (or noth none) they should not overwrite each other
(like in page.headerData) but get displayed both in the order they were defined.

Fifth: I don't like the separation between CSS and JS. Why not just implementing
page.references for all references.

Sixth (My proposal, based on Thomas):

page.references{

   styles = fileadmin/css/style.css
   styles.compress = 1

   jQuery = fileadmin/js/jquery-min.js
   jQuery{
     position = bottom
     order = 10
   }

   lightbox = typo3conf/ext/mylightboxext/res/js/lightbox.js
   lightbox{
     compress = 1
     position = bottom
     order = 20
   }

   stats = fileadmin/js/stats.js
   stats.position = bottom

}

Results in:
<head>
   <link href="typo3temp/stylesheet_3a4694af60.css" rel="stylesheet" type="text/css" />
</head>
<body>
   ###CONTENT###
   <script type="text/javascript" src="fileadmin/js/jquery-min.js"></script>
   <script type="text/javascript" src="typo3temp/javascript_0b12553063.js"></script>
   <script type="text/javascript" src="fileadmin/js/stats.js"></script>
</body>

Explanation:
[styles] will get recognized as CSS-File and is rendered with a <link>-Tag. No position
was given so it's in the top (default). Compression was activated, so a temporary
CSS-File is created.
[jQuery] and the other JS-Scripts will be recognized as such and rendered with <script>-
Tags. [stats] has no .order and therefore appears at the very end.

I think for JS and CSS automatic recognition of the type and how to render is quite easy.
If you want to implement other references like favicon, canonicals, feeds etc maybe you
need an additional property .rel.

Let's implement this and mark all the other stuff as deprecated. I think it's a much cleaner
and more intuitive way.




More information about the TYPO3-dev mailing list