/** * Loads a view * Views need to be in the views directory and PHP files * * @param String $page The name of the PHP file in the views directory * @param Array $data Variables you wish to pass through to the view * @return Bool Retruns True if page loaded successfuly */ public static function load($page, $data = NULL) { $page = str_replace('.php', '', $page); //If there is data to include //extract said data if ($data !== NULL && is_array($data)) { extract($data); } //create path using the VIEWDIR Constant $path = VIEWDIR . $page . '.php'; if (file_exists($path)) { include $path; } else { error::no_view($page); //echo 'error:',$page,'<br>'; } }