From 12283bc63a3584a8b394044c8dc114897971901f Mon Sep 17 00:00:00 2001 From: tmont Date: Wed, 15 Oct 2008 07:13:44 +0000 Subject: [PATCH] the page title is now dynamic --- src/lib/PanaceaPageController.php | 2 +- src/lib/views/PanaceaTemplateView.php | 9 ++++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/lib/PanaceaPageController.php b/src/lib/PanaceaPageController.php index 238dac0..7b46f92 100644 --- a/src/lib/PanaceaPageController.php +++ b/src/lib/PanaceaPageController.php @@ -54,7 +54,7 @@ } try { - $templateView = new PanaceaTemplateView(); + $templateView = new PanaceaTemplateView($this->page); $templateView->addView($this->viewFactory->getView($this->page, $request->__toString())); return $templateView; } diff --git a/src/lib/views/PanaceaTemplateView.php b/src/lib/views/PanaceaTemplateView.php index f44f091..6d6be06 100644 --- a/src/lib/views/PanaceaTemplateView.php +++ b/src/lib/views/PanaceaTemplateView.php @@ -27,11 +27,18 @@ * * @author Tommy Montgomery * @since 2008-10-14 + * + * @param string $title The title of the page */ - public function __construct() { + public function __construct($title = 'Home') { + if (!is_string($title)) { + throw new InvalidTypeException(1, 'string', $title); + } + parent::__construct(); $this->defaultTitle = 'Panacea'; + $this->title = (!empty($title)) ? $title : 'Home'; } /**