I have these values in my application.ini
[production]
; Database;
resources.db.adapter = "pdo_mysql"
resources.db.params.host = "localhost"
resources.db.params.username = "user1"
resources.db.params.password = "password1"
resources.db.params.dbname = "projects__01"
;Names
website.settings.websiteName = "My website 1"
website.settings.websiteUrl = "http://www.mydomain1.com"
website.settings.title = "mydomain.com - mydomain"
website.settings.titleSeperator = " - "
[staging : production]
; Database;
resources.db.adapter = "pdo_mysql"
resources.db.params.host = "localhost"
resources.db.params.username = "user2"
resources.db.params.password = "password2"
resources.db.params.dbname = "projects__02"
;Exceptions
phpSettings.display_startup_errors = 1
phpSettings.display_errors = 1
resources.frontController.params.displayExceptions = 1
;Title and url
website.settings.websiteName = "My website 2"
website.settings.websiteUrl = "http://www.mydomain2.com"
[development : staging]
;Database
resources.db.adapter = "pdo_mysql"
resources.db.params.host = "localhost"
resources.db.params.username = "user3"
resources.db.params.password = "password3"
resources.db.params.dbname = "projects__03"
;Title and url
website.settings.websiteName = "My website 3"
website.settings.websiteUrl = "http://www.mydomain3.com"
The problem is all database and exception values work properly, meaning that they are inheriting properly as they are supposed to
But the values I have set for Title and url do not inherit properly, only the first defined ones are used.
Why is this? is this by design? are only predefined/standard environment values such as database and exceptions are inherited?
Or am I making a mistake somewhere?
Okay, from your comment it sounds like you are creating a new Zend_Config object in the bootstrap, putting this in the registry, and it's this that's not returning what you'd expect. If this is the case I'm guessing that you've omitted the second parameter on the config object, so you have something like this:
but what you should have is more like this:
the second param tells it what section of the config file to use, without that it will always get the same value.
However, you don't actually need to re-parse the config file since Zend Application has done this already. Instead you can access the options from the bootstrap class and use these to create an object (or just store the options in their existing array format):
and this should work as you expect.
If my guess was wrong, please can you edit your question to include the relevant part of your bootstrap where the config object is created and stored in the registry.