Hi Steve,
You only need the one ini file for that. You can break up the ini
file into 'sections', with each section having the ability to inherit
from previous sections. For example:-
[all]
db.username = foo
db.password = bar
db.database = mydatabase
[development:all]
db.username = foodev
db.password = bardev
[local:development]
db.username = foolocal
When you need to load the config file, simply use the following (cut
and pasted from the manual):-
$config = new Zend_Config_Ini('/path/to/config.ini', 'development');
...where 'development' means that you'll end up by overriding the
password and username for the 'db' directives in your config file. If
you'd used 'local' then you'd get the 'foolocal' username, the
'bardev' password and the 'mydatabase' database name.
Hope that helps
Hi,
I've been trying to figure out the best way to merge two
Zend_Config objects together.
What I want to be able to do is have one master INI file in my
application directory and then one INI file per application
instance, which will allow me to override settings in the master
INI file. I took a look around the documentation and the code for
Zend_Config but wasn't able to find an existing way to do this.
What I think I'll have to do is write a recursive iterator or a
combination of asArray() and a custom array_merge function but I
wanted to check here if I'm missing something and if there is an
easier way to accomplish this?
Thanks,
Steve
--
Simon Mundy | Director | PEPTOLAB
""" " "" """""" "" "" """"""" " "" """"" " """"" " """""" "" "
202/258 Flinders Lane | Melbourne | Victoria | Australia | 3000
Voice +61 (0) 3 9654 4324 | Mobile 0438 046 061 | Fax +61 (0) 3 9654
4124
http://www.peptolab.com