/ Published in: PHP
Same Zend config.ini file with layout, module support, database and custom options. Also some bootstrap code to get custom config items into the systems registry
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
[production] ;Error Reporting phpSettings.display_startup_errors = 0 phpSettings.display_errors = 0 ;External Library support includePaths.library = APPLICATION_PATH "/../library" autoloaderNamespaces.projname = "ProjName_" ;Bootstrap path bootstrap.path = APPLICATION_PATH "/Bootstrap.php" bootstrap.class = "Bootstrap" ;Layout support resources.layout.layoutPath = APPLICATION_PATH "/views/layouts" resources.layout.layout = default appnamespace = "Application" resources.frontController.controllerDirectory = APPLICATION_PATH "/controllers" resources.frontController.params.displayExceptions = 0 ;Module suport resources.frontController.params.prefixDefaultModule = "1" resources.frontController.moduleDirectory = APPLICATION_PATH "/modules" resources.frontController.defaultModule = "default" resources.modules[] = ;Additional (custom) facebook.id = #### facebook.secret = #### baseUrl = "http://someapp.net" google.api = "blahblahblah" ;Database (production) resources.db.adapter = "Pdo_Mysql" resources.db.params.host = "localhost" resources.db.params.username = "user" resources.db.params.password = "pass" resources.db.params.dbname = "db_name" ;Custom routes resources.router.routes.connect.route = "app/connect" resources.router.routes.connect.defaults.controller = "index" resources.router.routes.connect.defaults.action = "connect" resources.router.routes.connect.defaults.module = "app" resources.router.routes.article.route = "article/:url_title/*" resources.router.routes.article.defaults.controller = "index" resources.router.routes.article.defaults.action = "show" resources.router.routes.article.defaults.module = "default" resources.router.routes.article.defaults.url_title = "" routes.article.reqs.url_title = "\s+" resources.router.routes.flag.route = "flag/:id" resources.router.routes.flag.defaults.controller = "index" resources.router.routes.flag.defaults.action = "flag" resources.router.routes.flag.defaults.module = "default" resources.router.routes.flag.defaults.id = "" routes.flag.reqs.id = "\d+" [staging : production] ;No staging used in this case [testing : production] ;We want errors in testing phpSettings.display_startup_errors = 1 phpSettings.display_errors = 1 resources.frontController.params.displayExceptions = 1 [development : production] ;Development - many times localhost phpSettings.display_startup_errors = 1 phpSettings.display_errors = 1 resources.frontController.params.displayExceptions = 1 baseUrl = "http://localhost:8888/app/public" ;Different params for facebook facebook.id = ####### facebook.secret = ###### ;Database (localhost) resources.db.adapter = "Pdo_Mysql" resources.db.params.host = "localhost" resources.db.params.username = "root" resources.db.params.password = "root" resources.db.params.dbname = "localdb_name" <?php //BONUS - Using boostrap.php to get custom config items //use Zend_Registry::get('key') anywhere to get the set registry data class Bootstrap extends Zend_Application_Bootstrap_Bootstrap { protected function _initRegistry() { Zend_Registry::set('facebook', $this->getOption('facebook')); $googleApi = $this->getOption('google'); Zend_Registry::set('googleApi', $googleApi['api']); } }