How to set up site specific configuration vs application configuration in Zend Framework?

Posted by rbruhn on Stack Overflow See other posts from Stack Overflow or by rbruhn
Published on 2010-06-13T14:17:44Z Indexed on 2010/06/13 14:22 UTC
Read the original article Hit count: 165

Filed under:

Being fairly new to Zend Framework, I've been reading and trying out various tutorials on the web and books I've purchased. One thing all the tutorials do is hard code certain values into into the bootstrap or other code. For example, setting the title:

$this->_view->headTitle('MySite');

I realize this can be set in the application.ini file, but I don't think that is appropriate either if you are distributing the application to other sites.

I would be interested in hearing ideas where application specific settings are set in the application.ini file and loaded:

$application = new Zend_Application(
    APPLICATION_ENV,
    APPLICATION_PATH.'/configs/application.ini'
);

Then somewhere in the bootstrap, checking for a config.ini file and adding these to currently existing application config array, and if config.ini does not exist, retrieving such site specific configs from a database and writing the config.ini file (Obviously the file deleted and rewritten if a value is changed in the database). I don't need to see how the file is written or what not... just a general idea of how others are handling such things. Or provide different ideas of doing this?

I would rather end up using something like this when setting various site specific configurations:

$this->_view->headTitle($config->site->title);

Hope this makes sense :-)

© Stack Overflow or respective owner

Related posts about zend-framework