ENHANCEMENT #2700 - Added section title to CMS title tag

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/cms/trunk@62894 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Sam Minnee 2008-09-23 02:24:23 +00:00
parent 1844173308
commit 366ceda590
2 changed files with 14 additions and 1 deletions

View File

@ -342,6 +342,7 @@ class LeftAndMain extends Controller {
return $menu; return $menu;
} }
/** /**
* Return a list of appropriate templates for this class, with the given suffix * Return a list of appropriate templates for this class, with the given suffix
*/ */
@ -888,6 +889,18 @@ JS;
return self::$application_link; return self::$application_link;
} }
/**
* Return the title of the current section, as shown on the main menu
*/
function SectionTitle() {
// Get menu - use obj() to cache it in the same place as the template engine
$menu = $this->obj('MainMenu');
foreach($menu as $menuItem) {
if($menuItem->LinkingMode == 'current') return $menuItem->Title;
}
}
/** /**
* The application logo path. Customisable by calling * The application logo path. Customisable by calling
* LeftAndMain::setLogo() - the first parameter. * LeftAndMain::setLogo() - the first parameter.

View File

@ -3,7 +3,7 @@
<head> <head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8" /> <meta http-equiv="Content-type" content="text/html; charset=utf-8" />
<% base_tag %> <% base_tag %>
<title>$ApplicationName</title> <title>$ApplicationName | $SectionTitle</title>
</head> </head>
<body class="stillLoading $CSSClasses"> <body class="stillLoading $CSSClasses">