From 366ceda590766f590f0ce2f9e7eb4ada17145ad7 Mon Sep 17 00:00:00 2001 From: Sam Minnee Date: Tue, 23 Sep 2008 02:24:23 +0000 Subject: [PATCH] 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 --- code/LeftAndMain.php | 13 +++++++++++++ templates/LeftAndMain.ss | 2 +- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/code/LeftAndMain.php b/code/LeftAndMain.php index 79d1d530..eff3979a 100644 --- a/code/LeftAndMain.php +++ b/code/LeftAndMain.php @@ -342,6 +342,7 @@ class LeftAndMain extends Controller { return $menu; } + /** * Return a list of appropriate templates for this class, with the given suffix */ @@ -888,6 +889,18 @@ JS; 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 * LeftAndMain::setLogo() - the first parameter. diff --git a/templates/LeftAndMain.ss b/templates/LeftAndMain.ss index a78812b0..b4d8c12c 100644 --- a/templates/LeftAndMain.ss +++ b/templates/LeftAndMain.ss @@ -3,7 +3,7 @@ <% base_tag %> -$ApplicationName +$ApplicationName | $SectionTitle