Added ability to load classes in views

pull/11/head
Mike Cao 14 years ago
parent eeb32df46e
commit 6b059c2492

@ -4,7 +4,6 @@
*
* @copyright Copyright (c) 2011, Mike Cao <mike@mikecao.com>
* @license http://www.opensource.org/licenses/mit-license.php
* @version 0.1
*/
class View {
public $path;
@ -103,6 +102,15 @@ class View {
return $output;
}
/**
* Displays escaped output.
*
* @param string $str String to escape
*/
public function e($str) {
echo htmlentities($str);
}
/**
* Loads and executes view helper functions.
*
@ -114,12 +122,13 @@ class View {
}
/**
* Displays escaped output.
* Loads view helper classes.
*
* @param string $str String to escape
* @param string $name Class name
* @return object Class instance
*/
public function e($str) {
echo htmlentities($str);
public function __get($name) {
return Flight::load($name);
}
}
?>

Loading…
Cancel
Save