Index: typo3/template.php
===================================================================
--- typo3/template.php (revision 5734)
+++ typo3/template.php (working copy)
@@ -204,23 +204,14 @@
var $sectionFlag=0; // Internal: Indicates if a
-output section is open
var $divClass = ''; // (Default) Class for wrapping
-tag of page. Is set in class extensions.
- // internal flags for JS-libraries
- protected $addPrototype = false;
- protected $addScriptaculousModules = array(
- 'builder' => false,
- 'effects' => false,
- 'dragdrop' => false,
- 'controls' => false,
- 'slider' => false
- );
- protected $addExtJS = false;
- protected $extJSadapter = 'ext/ext-base.js';
- protected $enableExtJsDebug = false;
+ var $pageHeaderBlock = '';
+ var $endOfPageJsBlock = '';
- // available adapters for extJs
- const EXTJS_ADAPTER_JQUERY = 'jquery';
- const EXTJS_ADAPTER_PROTOTYPE = 'prototype';
- const EXTJS_ADAPTER_YUI = 'yui';
+ var $hasDocheader = true;
+
+ // class for render the header / footer
+ var $pageIncludes;
+ var $pageHeaderFooterTemplateFile = ''; // alternative template file
/**
@@ -269,6 +260,8 @@
// Background image
if ($TBE_STYLES['background']) $this->backGroundImage = $TBE_STYLES['background'];
+
+ $this->pageIncludes = t3lib_div::makeInstance('t3lib_pageIncludes');
}
@@ -631,18 +624,23 @@
}
}
- // Get META tag containing the currently selected charset for backend output. The function sets $this->charSet.
- $charSet = $this->initCharset();
- $generator = $this->generator();
-
+ // alternative template for Header and Footer
+ if ($this->pageHeaderFooterTemplateFile) {
+ $file = t3lib_div::getFileAbsFileName($this->pageHeaderFooterTemplateFile, TRUE);
+ if ($file) {
+ $this->pageIncludes->setAlternativeTemplateFile($file);
+ }
+ }
// For debugging: If this outputs "QuirksMode"/"BackCompat" (IE) the browser runs in quirks-mode. Otherwise the value is "CSS1Compat"
# $this->JScodeArray[]='alert(document.compatMode);';
// Send HTTP header for selected charset. Added by Robert Lemke 23.10.2003
+ $this->initCharset();
header ('Content-Type:text/html;charset='.$this->charset);
-
+ $this->pageIncludes->backPath = $this->backPath;
+
// Standard HTML tag
- $htmlTag = '';
+ $this->pageIncludes->setHtmlTag('');
switch($this->docType) {
case 'html_3':
@@ -697,27 +695,39 @@
$headerStart = $headerStart . chr(10) . $xmlStylesheet;
}
}
+
+ $this->pageIncludes->setXmlPrologAndDocType($headerStart);
+ $this->pageIncludes->setHeadTag('' . chr(10). '');
+ $this->pageIncludes->setMetaCharsetTag($this->charset);
+ $this->pageIncludes->addMetaData($this->generator());
+ $this->pageIncludes->setTitle($title);
+
+ // add docstyles
+ $this->docStyle();
+
+
+ // add jsCode - has to go to headerData as it may contain the script tags already
+ $this->pageIncludes->addHeaderData($this->JScode);
+
+ foreach ($this->JScodeArray as $name => $code) {
+ $this->pageIncludes->addJsInlineCode($name, $code);
+ }
+
+ if ($this->extJScode) {
+ $this->pageIncludes->addJsHandlerCode($this->extJScode, t3lib_pageIncludes::JSHANDLER_EXTONREADY);
+ }
// Construct page header.
- $str = $headerStart . chr(10) . $htmlTag . '
-
-
- '.$charSet.'
- '.$generator.'
-
'.htmlspecialchars($title).'
- '.$this->docStyle().'
- ' . $this->renderJSlibraries() . '
- '.$this->JScode.'
- '.$this->wrapScriptTags(implode("\n", $this->JScodeArray)).
- ($this->extJScode ? $this->wrapScriptTags('Ext.onReady(function() {' . chr(10) . $this->extJScode . chr(10) . '});') : '') .
- '
-
+ $str = $this->pageIncludes->render();
+ $str .= '
';
$this->JScodeLibArray = array();
$this->JScode = $this->extJScode = '';
$this->JScodeArray = array();
+ $this->endOfPageJsBlock = $this->pageIncludes->render(1);
+
if ($this->docType=='xhtml_frames') {
return $str;
} else
@@ -750,7 +760,7 @@
$str .= ($this->divClass?'
-':'').'
+
':'') . $this->endOfPageJsBlock . '
';
}
@@ -956,28 +966,20 @@
$this->inDocStylesArray[] = $this->inDocStyles_TBEstyle;
// Implode it all:
- $inDocStyles = implode('
- ',$this->inDocStylesArray);
+ $inDocStyles = implode(chr(10), $this->inDocStylesArray);
- // The default color scheme should also in full be represented in the stylesheet.
- $style=trim('
- '.($this->styleSheetFile?'