diff options
-rw-r--r-- | framework/Web/Services/TPageService.php | 4 | ||||
-rw-r--r-- | framework/Web/UI/TPage.php | 12 | ||||
-rw-r--r-- | framework/Web/UI/TTemplateManager.php | 3 |
3 files changed, 15 insertions, 4 deletions
diff --git a/framework/Web/Services/TPageService.php b/framework/Web/Services/TPageService.php index b07527c6..0d8f28b9 100644 --- a/framework/Web/Services/TPageService.php +++ b/framework/Web/Services/TPageService.php @@ -442,8 +442,10 @@ class TPageService extends TService }
else
$className='TPage';
+ //allow the page constructor to change application settings before template is loaded
+ $this->_page=new $className();
$this->_properties['Template']=$this->getTemplateManager()->getTemplateByFileName($path.self::PAGE_FILE_EXT);
- $this->_page=new $className($this->_properties);
+ $this->_page->initializeProperties($this->_properties);
}
else
throw new THttpException(404,'pageservice_page_unknown',$this->_pagePath);
diff --git a/framework/Web/UI/TPage.php b/framework/Web/UI/TPage.php index 70439237..28f1b036 100644 --- a/framework/Web/UI/TPage.php +++ b/framework/Web/UI/TPage.php @@ -111,11 +111,18 @@ class TPage extends TTemplateControl private $_previousPagePath='';
/**
- * Constructor.
+ * Constructor, overrides parent implementation. Parent constructor called in initializeProperties.
+ */
+ public function __construct()
+ {
+
+ }
+
+ /**
* If initial property values are given, they will be set to the page.
* @param array initial property values for the page.
*/
- public function __construct($initProperties=null)
+ public function initializeProperties($initProperties=null)
{
Prado::trace('Constructing page','System.Web.UI.TPage');
$this->setPage($this);
@@ -125,6 +132,7 @@ class TPage extends TTemplateControl foreach($initProperties as $name=>$value)
$this->setSubProperty($name,$value);
}
+ //ask template control to initialize
parent::__construct();
}
diff --git a/framework/Web/UI/TTemplateManager.php b/framework/Web/UI/TTemplateManager.php index 3c522897..312b821d 100644 --- a/framework/Web/UI/TTemplateManager.php +++ b/framework/Web/UI/TTemplateManager.php @@ -355,7 +355,8 @@ class TTemplate extends TComponent implements ITemplate $component->$setter($this->getApplication()->getParameters()->itemAt($value[1]));
break;
case self::CONFIG_LOCALIZATION:
- $component->$setter(localize($value[1]));
+ Prado::using('System.I18N.Translation');
+ $component->$setter(localize(trim($value[1])));
break;
default: // an error if reaching here
break;
|