[FEATURE] Integrate config.pageTitleSeparator
authorMario Rimann <typo3-coding@rimann.org>
Fri, 2 Dec 2011 21:53:49 +0000 (22:53 +0100)
committerSteffen Ritter <info@rs-websystems.de>
Fri, 16 Dec 2011 13:06:17 +0000 (14:06 +0100)
Adds a Typoscript option to make the the separator string that is
used between the site title and the page title configurable.

Change-Id: I8fd088ee15d09a0c2414d48d30058c2ed85a1b98
Resolves: #17030
Releases: 4.7
Reviewed-on: http://review.typo3.org/7041
Reviewed-by: Markus Klein
Tested-by: Markus Klein
Reviewed-by: Steffen Ritter
Tested-by: Steffen Ritter
t3lib/class.t3lib_tstemplate.php

index 6629625..d213368 100644 (file)
@@ -1190,19 +1190,25 @@ class t3lib_TStemplate {
         * @return      string          The page title on the form "[sitetitle]: [input-title]". Not htmlspecialchar()'ed.
         * @see tslib_fe::tempPageCacheContent(), TSpagegen::renderContentWithHeader()
         */
-       function printTitle($title, $no_title = 0, $titleFirst = 0) {
-               $st = trim($this->setup['sitetitle']) ? $this->setup['sitetitle'] : '';
-               $title = $no_title ? '' : $title;
-               if ($titleFirst) {
-                       $temp = $st;
-                       $st = $title;
-                       $title = $temp;
-               }
-               if ($title && $st) {
-                       return $st . ': ' . $title;
-               } else {
-                       return $st . $title;
+       function printTitle($pageTitle, $noTitle = FALSE, $showTitleFirst = FALSE) {
+               $siteTitle = trim($this->setup['sitetitle']) ? $this->setup['sitetitle'] : '';
+               $pageTitle = $noTitle ? '' : $pageTitle;
+               $pageTitleSeparator = '';
+
+               if ($showTitleFirst) {
+                       $temp = $siteTitle;
+                       $siteTitle = $pageTitle;
+                       $pageTitle = $temp;
+               }
+
+               if ($pageTitle != '' && $siteTitle != '') {
+                       $pageTitleSeparator = ': ';
+                       if (isset($this->setup['config.']['pageTitleSeparator']) && $this->setup['config.']['pageTitleSeparator']) {
+                               $pageTitleSeparator = $this->setup['config.']['pageTitleSeparator'] . ' ';
+                       }
                }
+
+               return $siteTitle . $pageTitleSeparator . $pageTitle;
        }
 
        /**