This post refers to DotKernel 1, based on Zend Framework 1.
If you are looking for DotKernel 3 related posts, go here.

updated April 8th, 2012, according to DotKernel version 1.6.0 pre-release

The application.ini file stores the main settings for the application. The file is split in different sections, each defining an environment: production, staging and development.

Each environment can have different settings.

In application.ini we have the following variable settings:

  • website.param.url –  the application URL
  • database.params –  database settings(host, database name, username, password, profiler)
  • phpSettings – different PHP settings customization should be mentioned here
  • settings – application settings split into modules (admin, frontend,…)
  • resources – list of modules

application.ini sample code:

website.params.url =     = localhost
database.params.dbname   = dot_kernel
database.params.username = dot_kernel
database.params.password = XXXXXX
database.params.charset = utf8
database.params.profiler = FALSE
database.params.persistent = FALSE
phpSettings.display_errors = 0
phpSettings.display_startup_errors = 1 = America/New_York
;list settings
settings.admin.salt = 5F6WQ9U3YT
settings.frontend.debugbar = false
settings.admin.debugbar = false
; list all modules
resources.modules.frontend  = frontend
resources.modules.admin  = admin
resources.modules.rss  = rss
;session related settings
resources.session.use_only_cookies = on
resources.session.remember_me_seconds = 3600
resources.geoip.path = externals/geoip/GeoIP.dat = TRUE
resources.useragent.wurflapi.redirect = TRUE
resources.useragent.wurflapi.api_version = "1.2.1"
; only use APC for caching wurfl, anything else is useless
resources.useragent.wurflapi.cache = TRUE
resources.useragent.wurflapi.cache_namespace = TESTNAMESPACE
resources.useragent.wurflapi.cache_lifetime = 3600
resources.useragent.wurflapi.lib_dir = APPLICATION_PATH "/library/Wurfl/"
resources.useragent.wurflapi.config_file = APPLICATION_PATH "/configs/useragent/wurfl.xml"
[staging: production]
; Staging site configuration data inherits from production and
; overrides values as necessary
website.params.url =     = localhost
database.params.dbname   = dot_v1kernel
database.params.username = dot_v1kernel
database.params.password = XXXXXX
database.params.profiler = true
phpSettings.display_errors = 1 
;list settings
settings.frontend.debugbar = true
settings.admin.debugbar = true
[development: production]
; Development site configuration data inherits from production and
; overrides values as necessary
website.params.url = http://localhost/DotKernel     =
database.params.dbname   = dot_kernel
database.params.username = root
database.params.password = 1234
database.params.profiler = true
phpSettings.display_errors = 1 = Europe/Bucharest
;list settings
settings.frontend.debugbar = true
settings.admin.debugbar = true

As you may have noticed, each environment overwrites the previous environment’s settings.
If you consider that your application needs more setting variables, feel free to add them.

This file is read by the Zend_Config_Ini class:

//Load configuration settings from application.ini file
$config = new Zend_Config_Ini(CONFIGURATION_PATH.'/application.ini', 'production' );
$url = $config->website->param->url;

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>