diff --git a/flight/View.php b/flight/View.php index 1dfbac8..2059ef0 100644 --- a/flight/View.php +++ b/flight/View.php @@ -106,11 +106,22 @@ class View { * Displays escaped output. * * @param string $str String to escape + * @return string Escaped string */ public function e($str) { echo htmlentities($str); } + /** + * Checks if a template file exists. + * + * @param string $file Template file + * @return bool Template file exists + */ + public function exists($file) { + return file_exists($this->path.'/'.((substr($file, -4) == '.php') ? $file : $file.'.php')); + } + /** * Loads and executes view helper functions. *