require_once SCAFFOLD_PATH . '/lib/Scaffold/Environment.php'; /** * Set timezone, just in case it isn't set. PHP 5.3+ * throws a tantrum if you try and use time() without * this being set. */ date_default_timezone_set('GMT'); /** * Automatically load any Scaffold Classes */ Scaffold_Environment::auto_load(); /** * Let Scaffold handle errors */ Scaffold_Environment::handle_errors(); /** * Set the view to use for errors and exceptions */ Scaffold_Environment::set_view(realpath(SCAFFOLD_PATH . '/views/error.php')); # Scaffold Config $config = $GLOBALS['ApplicationConfiguration']['compiler']['scaffold']['config']; # The container creates Scaffold objects $Container = Scaffold_Container::getInstance(SCAFFOLD_PATH, $config); # This is where the magic happens $Scaffold = $Container->build(); # Compile $Source = $Scaffold->getSource(null, $config); // Compiles the source object $Source = $Scaffold->compile($Source); // Use the result to render it to the browser. Hooray! $Scaffold->render($Source);
* throws a tantrum if you try and use time() without * this being set. */ date_default_timezone_set('GMT'); /** * Automatically load any Scaffold Classes */ Scaffold_Environment::auto_load(); /** * Let Scaffold handle errors */ Scaffold_Environment::handle_errors(); /** * Set the view to use for errors and exceptions */ Scaffold_Environment::set_view(realpath($system . '/views/error.php')); // ========================================= // = Start the scaffolding magic = // ========================================= // Make sure the config var is set if (!isset($config)) { $config = array(); } // The container creates Scaffold objects $container = new Scaffold_Container($system, $config); // This is where the magic happens $scaffold = $container->build(); // Get the requested source if (isset($_GET['file'])) { $source = new Scaffold_Source_File($scaffold->helper->load->file($_GET['file'])); } elseif (isset($_GET['url']) and $config['enable_url'] === true) {
/** * Set a view file to use for errors and exceptions * @author Anthony Short * @param $path Path to the view file * @return void */ public static function set_view($path) { if (is_file($path)) { self::$_view = $path; } else { throw new Exception('[Environment] Path to view file is not valid'); } }