From 2f4210ad3fb670d728bab0fb78d2841a3d2330ba Mon Sep 17 00:00:00 2001 From: Erwin Date: Fri, 24 Oct 2014 23:32:28 +0200 Subject: [PATCH] Using multiple template paths I want to use more template directory's along with the multiple flight.views.path during execution of the script. So want to be able to change it on the fly, during execution. And I want the extra template directory's to be outside of the normal flight.views.path. I tried a lot of ways without changing the View.php but this change is simpel and works for me. This way I can easily do: Flight::render(TPL_PATH.'hello', ['name'=>'Bob'], 'header_content'); --- flight/template/View.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/flight/template/View.php b/flight/template/View.php index 2e53225..2c4e95c 100644 --- a/flight/template/View.php +++ b/flight/template/View.php @@ -154,7 +154,13 @@ class View { if ((substr($file, -4) != '.php')) { $file .= '.php'; } - return $this->path.'/'.$file; + if ((substr($file, 0, 1) == '/')) { + return $file; + } + else + { + return $this->path.'/'.$file; + } } /**