diff --git a/src/Application.php b/src/Application.php index b82e90d..48d15a8 100644 --- a/src/Application.php +++ b/src/Application.php @@ -27,6 +27,8 @@ class Application */ private $ApplicationConfig; + public $autoTemplate = false; + /** * Constructor * @param Config $Config Instance of Config must be given @@ -79,6 +81,12 @@ public function run($callable, $params = array()) $Instance->ApplicationConfig = $this->ApplicationConfig; $Instance->Param = (object) $params; + if ($this->autoTemplate) { + if ($Instance instanceof Presenter) { + $Instance->View->setTemplate(strtolower($controllerClass."/".$controllermethod)); + } + } + $Rule->Instance = $Instance; $this->Resolver->addRule($Rule); @@ -96,4 +104,11 @@ public function run($callable, $params = array()) $this->Resolver->execute($callable, $params); } } + + public function autoTemplate($bool = true) + { + $this->autoTemplate = $bool; + + return $this; + } }