[TYPO3-core] RFC #6833: Possibility to add inline JS to page

Ernesto Baschny [cron IT] ernst at cron-it.de
Mon Nov 26 17:37:11 CET 2007


Martin Kutschker wrote: on 26.11.2007 12:16:

>>> Please name it page.inlineJS to be in sync with TS page.includeJS.
>>
>> -1. The proposed construct does not work like page.includeJS, so I
>> think having a very close sounding name might cause confusion.
> 
> Tghis is because the original property is wrong. If it'd be like that
> there would be no problem:
> 
> page.header.javascript.js1.disposition = external
> page.header.javascript.js1.file = fileadmin/myfile.js
> page.header.javascript.js2.disposition = inline
> page.header.javascript.js2.text = TEXT
> page.header.javascript.js2.text.value  = ...
> 
> Note the page.header. This signifies we operate in the heaer section. So
> we can have a similiar javascript properties for the body. One for the
> start (right after the opening <body> tag and another one for the end
> (right before the closing </body> tag).
> 
> Anyway, have it your way. Seems like I'm the only one who has a real
> problem with the TS property names.

Not true! Consider all my abstensions from voting on property naming
that I agree with you, Masi. ;)

The above proposition sounds very cool. I would minimize the
requirements, as the "disposition" is already implicit from the
properties you set. So I would suggest:

page.header.script.js1.src = fileadmin/myfile.js
page.header.script.js2.content = TEXT
page.header.script.js2.content.value  = ...

"src" to be in line with the XHTML attribute for the <script> tag and
"content", well, because it is the content for the tag. While this will
mainly be used for javascript, the XHTML tag is called <script>, which
is why I would call the array-key like that too (instead of javascript),
with a default of: type="text/javascript" (some crazy guy might want to
use that for type="text/vbscript"). In my eyes, the disposition is
implicit, which is why we don't need that information: having a "src"
makes it external, with "content" it might be inline (default) or
external (if a future config option "inlineScript2TempFile" is set).

Somthing like that could be extended to "inline CSS" as well.

page.header.stylesheet.css1.src = fileadmin/styles.css
page.header.stylesheet.css2.content = TEXT
page.header.stylesheet.css2.content.value = ...

But lets still leave something to work on in 4.3...

Cheers,
Ernesto


More information about the TYPO3-team-core mailing list