[TYPO3-project-4-3] Header / Footer class for BE and FE
Steffen Kamper
info at sk-typo3.de
Tue Jun 16 09:39:08 CEST 2009
Hi,
after a brainstorm with olly i concepted a class that renders all
header- and footer-parts for a webpage. This class can be used for BE
and FE, which makes it universal, and there is a central place where
this stuff is handled.
The aim was
* include javascript libs simple (which was the case for template.php)
* introduce a concatenate and compress feature, which is not implemented
yet but prepared
* add footer part, which is a missing feature. There is one flag which
moves all javascript to end of the page
* add ExtCore as supported javascript library
The attached patches is the woring code for this concept. I implemented
it in the way, that behaviour is same as before, so you don't need to
change anything in BE/FE settings, but added a few possibilities.
For FE there are possibilities with TS, and direct control as the header
class is in TSFE, in BE the class is instanced by template.
$GLONALS['TSFE']->pageIncludes
$this->doc->pageIncludes
This is the way how ro include javascript libs in FE:
page {
# load javascript libs
javascriptLibs {
# load prototype
Prototype = 1
#load Scriptaculous with optional modules
Scriptaculous = 1
Scriptaculous {
modules = dragdrop,controls
}
# load ExtCore
ExtCore = 1
# enable ExtCore debug
ExtCore.debug = 1
# load ExtJs
ExtJs = 1
ExtJs {
# include ext-all.css
css = 1
# include t3skin / gray theme
theme = 1
# load specific adapter
adapter = jquery
# enable debug
debug = 1
}
}
# this code is wrapped in Ext.onReady-Block
inlineJSExtOnReady {
10 = TEXT
10.value = this.ball = 1;
20 = TEXT
20.value = this.switch = 1;
}
# this code is inserted at end of page
inlineFooterJS {
10 = TEXT
10.value = var eee = 1;
20 = TEXT
20.value = var rrr = 1
}
}
There is also a parameter which moves all existing Javascript to end of
page:
config.swapJsFromHeaderToFooter = 1
These settings are implemented but has no effect atm:
config.minifyCSS
config.concatenateJSandCSS
Of course all settings are available in php too using methods of the
header class.
The Headerparts (headerData) is inserted as it is without any change, as
this is kind of free text and already wrapped script links. So if you
want to get the advantages of this processing you should add JS and CSS
with the other methods.
The rendering is template based, so you can move your parts easy around
by rearranging the marker in template.
I divided the patch in 3 parts which makes it a lot easier to read.
I look forward to your comments,
vg Steffen
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: pageinclude_prototype.diff
Url: http://lists.netfielders.de/pipermail/typo3-project-4-3/attachments/20090616/32cd03b7/attachment-0003.txt
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: pageinclude_for BE.diff
Url: http://lists.netfielders.de/pipermail/typo3-project-4-3/attachments/20090616/32cd03b7/attachment-0004.txt
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: pageinclude_for FE.diff
Url: http://lists.netfielders.de/pipermail/typo3-project-4-3/attachments/20090616/32cd03b7/attachment-0005.txt
More information about the TYPO3-project-4-3
mailing list