Added config for view path.

pull/11/head
Mike Cao 14 years ago
parent b8faba3dc5
commit ac3a75fe4f

@ -1,16 +1,16 @@
<?php <?php
/** /**
* Flight: an extensible PHP micro-framework. * Flight: An extensible micro-framework.
* *
* @copyright Copyright (c) 2011, Mike Cao <mike@mikecao.com> * @copyright Copyright (c) 2011, Mike Cao <mike@mikecao.com>
* @license http://www.opensource.org/licenses/mit-license.php * @license http://www.opensource.org/licenses/mit-license.php
* @version 0.1 * @version 0.1
*/ */
class View { class View {
protected $templatePath; public $path;
public function __construct($templatePath = null) { public function __construct($path = null) {
$this->templatePath = $templatePath ?: './views'; $this->path = $path ?: (Flight::get('flight.view.path') ?: './views');
} }
/** /**
@ -35,7 +35,7 @@ class View {
} }
// Display template // Display template
include $this->templatePath.'/'.((substr($file,-4) == '.php') ? $file : $file.'.php'); include $this->path.'/'.((substr($file,-4) == '.php') ? $file : $file.'.php');
} }
/** /**

Loading…
Cancel
Save