Hi Rob,Thanks for the reply.

I do not that much configuration per module.  For example a news module
could have a config option to indicate the number of news to be fetched by
default, the name of the ID to be used with Zend_Cache etc.

I am trying to use Zend_Config_Xml but a code like this

<?xml version="1.0" encoding="UTF-8"?>

<configdata>

        <production>

        </production>

        <staging>

        </staging>

        <devel>

                <emailList>

                        <subject>

                          <item>Tech</item>

                          <email>[EMAIL PROTECTED]</email>

                        </subject>

                        <subject>

                          <item>Billing</item>

                          <email>[EMAIL PROTECTED]</email>

                        </subject>

                </emailList>

        </devel>

</configdata>


$config = new Zend_Config_Xml('config/config.xml', 'devel');

I should be able to do this, right?


$config->emailList->subject[0]->email


But in my test I can only access the last value (in this example the
[EMAIL PROTECTED]).



>
> Zend_Config supports the concept of inheritance within the config file.
> You can also use Zend_Config::merge() to merge multiple config objects into
> one if that suits you better.
>
>
> I currently use a single config.ini file that is structured something like
> this:
>
> [general]
> module1name.setting1 = value1
> module1name.setting2.setting2a = value2a
> module1name.setting2.setting2b = value 2b
> module2name.setting1 = value1
>
> [live : general]
> ; live site
> module1name.setting3 = livevalue3
>
> [dev : general]
> ; development settings
> module1name.setting3 = testvalue3
>
> [rka : dev]
> ; Rob's specific settings
> module1name.setting3 = testvalue3a
>
>
>
> I then load using something like this:
>
>
> if (getenv('ZF_CONFIG')) {
>     $configSection = getenv('ZF_CONFIG');
>     $config = new Zend_Config(new Zend_Config_Ini('config.ini',
> $configSection));
> } else {
>     die('Not configured!');
> }
>
>
> ZF_CONFIG is set using SetEnv within Apache's virtual host section or a
> .htaccess on the relevant server.
>
>
> There's nothing to stop you having a config file per module, in which
> case, I'd still use inheritance within the config file as it makes
> maintenance much easier. Do you really have that many configuration settings
> per module though?
>
>
> Regards,
>
> Rob...
>
>
>

Reply via email to