$config['Z_Application'] = array(); $config['Z_Application']['page']['path'] = realpath(dirname(__FILE__) . Z_DS . 'pages'); $config['Z_Application']['page']['class_prefix'] = 'Z_Page_'; // For default view options $config['Z_View'] = array(); $config['Z_View']['buffer_response'] = true; // if true, it'll buffer the output $config['Z_View']['template_dir'] = realpath(dirname(__FILE__) . '/views'); // For Smarty view' options $config['Z_View_Smarty'] = array(); $config['Z_View_Smarty']['template_dir'] = realpath(dirname(__FILE__) . '/views'); $config['Z_View_Smarty']['compile_dir'] = realpath(dirname(__FILE__) . '/runtime/views'); $config['Z_View_Smarty']['cache_dir'] = realpath(dirname(__FILE__) . '/runtime/views/cached'); /** * Configuration is done - preboot Z (you could do this usually before configuring though) */ /** * Register the auto loader */ Z::registerAutoloader(); /** * Register 'namespaces' (to basicly make it easier to include files */ Z::registerNamespace('Library', DEMO_LIBRARY); /** * Register 'namespaces' (to basicly make it easier to include files */ Z::registerNamespace('Smarty', '../../library/smarty/'); // Now we show that it does accept stdclass objects return Z_Array::ToObject($config);
/** * * @param unknown_type $config * @param unknown_type $class * @return Z_Application */ public static function createApplication($config = NULL, $init = NULL, $class = 'Z_Application') { if ($config == null) { $config = Z::getGlobal(Z_CONFIG); } /* * If $config is a string, a path is supplied to a php file that should * return nothing more than an array containing all Z-specific settings */ if (is_string($config)) { $config = (include $config); } if (is_array($config)) { $config = Z_Array::ToObject($config); } $config = self::_applyDefaultConfig($config); if (!class_exists($class)) { throw new Z_Exception('Application class not found: ' . $class); } Z::setGlobal(Z_CONFIG, $config); $app = new $class($config); if ($init != null) { global $application; $application = $app; include $init; $application = null; } return $app; }