From 09bb1bee86b88343a2d08ad5c06a6fa3c3070916 Mon Sep 17 00:00:00 2001 From: Markus Klein Date: Mon, 13 Jan 2014 11:03:42 +0100 Subject: [PATCH] [BUGFIX] title Resolves: #00000 Releases: 6.2, 6.1 Change-Id: I3d5be34b95cb295b92732d2f2f9bd1f123812365 --- typo3/sysext/core/Classes/Page/PageRenderer.php | 4 ++- .../Controller/TypoScriptFrontendController.php | 1 + .../sysext/frontend/Classes/Page/PageGenerator.php | 34 +++++++++++++++++----- 3 files changed, 30 insertions(+), 9 deletions(-) diff --git a/typo3/sysext/core/Classes/Page/PageRenderer.php b/typo3/sysext/core/Classes/Page/PageRenderer.php index 0adf18e..616a8f4 100644 --- a/typo3/sysext/core/Classes/Page/PageRenderer.php +++ b/typo3/sysext/core/Classes/Page/PageRenderer.php @@ -1920,7 +1920,9 @@ class PageRenderer implements \TYPO3\CMS\Core\SingletonInterface { public function renderJavaScriptAndCssForProcessingOfUncachedContentObjects($cachedPageContent, $substituteHash) { $this->prepareRendering(); list($jsLibs, $jsFiles, $jsFooterFiles, $cssFiles, $jsInline, $cssInline, $jsFooterInline, $jsFooterLibs) = $this->renderJavaScriptAndCss(); + $title = $this->title ? str_replace('|', htmlspecialchars($this->title), $this->titleTag) : ''; $markerArray = array( + '' => $title, '' => $cssFiles, '' => $cssInline, '' => $jsInline, @@ -2048,9 +2050,9 @@ class PageRenderer implements \TYPO3\CMS\Core\SingletonInterface { 'INLINECOMMENT' => $this->inlineComments ? LF . LF . '' . LF . LF : '', 'BASEURL' => $this->baseUrl ? str_replace('|', $this->baseUrl, $this->baseUrlTag) : '', 'SHORTCUT' => $this->favIcon ? sprintf($this->shortcutTag, htmlspecialchars($this->favIcon), $this->iconMimeType) : '', - 'TITLE' => $this->title ? str_replace('|', htmlspecialchars($this->title), $this->titleTag) : '', 'META' => implode(LF, $this->metaTags), 'BODY' => $this->bodyContent, + 'TITLE' => '', 'CSS_INCLUDE' => '', 'CSS_INLINE' => '', 'JS_INLINE' => '', diff --git a/typo3/sysext/frontend/Classes/Controller/TypoScriptFrontendController.php b/typo3/sysext/frontend/Classes/Controller/TypoScriptFrontendController.php index f24b65d..753c939 100644 --- a/typo3/sysext/frontend/Classes/Controller/TypoScriptFrontendController.php +++ b/typo3/sysext/frontend/Classes/Controller/TypoScriptFrontendController.php @@ -3412,6 +3412,7 @@ class TypoScriptFrontendController { $this->recursivelyReplaceIntPlaceholdersInContent(); $GLOBALS['TT']->push('Substitute header section'); $this->INTincScript_loadJSCode(); + \TYPO3\CMS\Frontend\Page\PageGenerator::generatePageTitle(); $this->content = str_replace( array( '', diff --git a/typo3/sysext/frontend/Classes/Page/PageGenerator.php b/typo3/sysext/frontend/Classes/Page/PageGenerator.php index ffb2873..ae3501a 100644 --- a/typo3/sysext/frontend/Classes/Page/PageGenerator.php +++ b/typo3/sysext/frontend/Classes/Page/PageGenerator.php @@ -724,14 +724,7 @@ class PageGenerator { if (is_array($GLOBALS['TSFE']->pSetup['footerData.'])) { $pageRenderer->addFooterData($GLOBALS['TSFE']->cObj->cObjGet($GLOBALS['TSFE']->pSetup['footerData.'], 'footerData.')); } - // Title - $titleTagContent = $GLOBALS['TSFE']->tmpl->printTitle($GLOBALS['TSFE']->altPageTitle ? $GLOBALS['TSFE']->altPageTitle : $GLOBALS['TSFE']->page['title'], $GLOBALS['TSFE']->config['config']['noPageTitle'], $GLOBALS['TSFE']->config['config']['pageTitleFirst']); - if ($GLOBALS['TSFE']->config['config']['titleTagFunction']) { - $titleTagContent = $GLOBALS['TSFE']->cObj->callUserFunction($GLOBALS['TSFE']->config['config']['titleTagFunction'], array(), $titleTagContent); - } - if (strlen($titleTagContent) && intval($GLOBALS['TSFE']->config['config']['noPageTitle']) !== 2) { - $pageRenderer->setTitle($titleTagContent); - } + static::generatePageTitle(); // Add ending slash only to documents rendered as xhtml $endingSlash = $GLOBALS['TSFE']->xhtmlVersion ? ' /' : ''; $pageRenderer->addMetaTag(''); @@ -1081,4 +1074,29 @@ class PageGenerator { return $OK; } + /** + * Generate title for page. + * Takes the settings ['config']['noPageTitle'], ['config']['pageTitleFirst'], ['config']['titleTagFunction'] + * and ['config']['noPageTitle'] into account. + * Furthermore $GLOBALS['TSFE']->altPageTitle is observed. + * + * @return void + */ + static public function generatePageTitle() { + $titleTagContent = $GLOBALS['TSFE']->tmpl->printTitle( + $GLOBALS['TSFE']->altPageTitle ? $GLOBALS['TSFE']->altPageTitle : $GLOBALS['TSFE']->page['title'], + $GLOBALS['TSFE']->config['config']['noPageTitle'], + $GLOBALS['TSFE']->config['config']['pageTitleFirst'] + ); + if ($GLOBALS['TSFE']->config['config']['titleTagFunction']) { + $titleTagContent = $GLOBALS['TSFE']->cObj->callUserFunction( + $GLOBALS['TSFE']->config['config']['titleTagFunction'], + array(), + $titleTagContent + ); + } + if ($titleTagContent !== '' && (integer)$GLOBALS['TSFE']->config['config']['noPageTitle'] !== 2) { + $GLOBALS['TSFE']->getPageRenderer()->setTitle($titleTagContent); + } + } } -- 1.8.4.msysgit.0