From 4f5eb66048c81746e8f36a9e35e04bf54bacc148 Mon Sep 17 00:00:00 2001 From: Cameron Date: Fri, 1 Oct 2021 07:18:37 -0700 Subject: [PATCH] Moved title tag directly under html tag. Changed separator to pipe | and added an option for processing the title in theme::title(). --- e107_core/templates/header_default.php | 58 ++++++++++++++++---------- 1 file changed, 35 insertions(+), 23 deletions(-) diff --git a/e107_core/templates/header_default.php b/e107_core/templates/header_default.php index 7a1036363..1522669f4 100644 --- a/e107_core/templates/header_default.php +++ b/e107_core/templates/header_default.php @@ -118,41 +118,53 @@ if(!defined("XHTML4")) echo "\n"; $htmlTag = ""; echo (defined('HTMLTAG') ? str_replace('THEME_LAYOUT', THEME_LAYOUT, HTMLTAG) : $htmlTag)."\n"; - echo "\n"; - echo "\n"; + echo " +".render_title()." +\n"; } else { echo (defined("STANDARDS_MODE") ? "" : "\n")."\n"; echo "\n"; echo " - - +".render_title()." + + "; echo (defined("CORE_LC")) ? "\n" : ""; } -// Load early -if(!defined('e_PAGETITLE') && ($_PAGE_TITLE = e107::getSingleton('eResponse')->getMetaTitle())) // use e107::title() to set. +function render_title() { - define('e_PAGETITLE', $_PAGE_TITLE); - e107::meta('og:title', $_PAGE_TITLE); // will only populate if not already defined. - unset($_PAGE_TITLE); + if(!defined('e_PAGETITLE') && ($_PAGE_TITLE = e107::getSingleton('eResponse')->getMetaTitle())) // use e107::title() to set. + { + define('e_PAGETITLE', $_PAGE_TITLE); + e107::meta('og:title', $_PAGE_TITLE); // will only populate if not already defined. + } + + $arr = []; + + if(!deftrue('e_FRONTPAGE')) + { + if(deftrue('e_PAGETITLE')) + { + $arr[] = e_PAGETITLE; + } + elseif(defined('PAGE_NAME')) + { + $arr[] = PAGE_NAME; + } + } + + $arr[] = SITENAME; + + if($custom = e107::callMethod('theme', 'title', $arr)) + { + return $custom; + } + + return implode(' | ', $arr); } - -if (deftrue('e_FRONTPAGE')) -{ - // Ignore any additional title when current page is the frontpage - echo "".SITENAME."\n\n"; -} -else -{ - - echo "".(deftrue('e_PAGETITLE') ? e_PAGETITLE.' - ' : (defined('PAGE_NAME') ? PAGE_NAME.' - ' : "")).SITENAME."\n\n"; - - unset($_PAGE_TITLE); -} - // // C: Send start of HTML //