Hello Matthew

Thank you for your kind reply.

> At this point, you can't.

I feel the documentation is a little misleading in this case:

----

4.2.2. Adding Zend_Application to your application

[...]

For this tutorial, we will use an INI style configuration; you may, of
course, use an XML or PHP configuration file as well.

http://www.zendframework.com/manual/en/zend.application.quick-start.html

----

The "tutorial" uses constants, which are currently not supported in
XML. In my opinion, the following should be appended to the above
sentence:

"However, note that in the case that you choose the XML option, you
cannot use constants."

Best regards

Jonathan Maron



On Thu, May 28, 2009 at 1:06 PM, Matthew Weier O'Phinney
<[email protected]> wrote:
> -- Jonathan Maron <[email protected]> wrote
> (on Thursday, 28 May 2009, 11:19 AM +0200):
>> For a number of reasons, I prefer to store configuration options in
>> XML files and not INI files.
>>
>> In "application.ini", it is possible to specify constants in the values:
>>
>> [production]
>> bootstrap.path = APPLICATION_PATH "/Bootstrap.php"
>> bootstrap.class = "Bootstrap"
>> resources.frontController.controllerDirectory = APPLICATION_PATH 
>> "/controllers"
>>
>> The structure of the above in XML would be:
>>
>> <production>
>>       <bootstrap>
>>               <path></path>
>>               <class></class>
>>       </bootstrap>
>>       <resources>
>>               <frontController>
>>                       <controllerDirectory></controllerDirectory>
>>               </frontController>
>>       </resources>
>> </production>
>>
>> How can I use constants in the XML?
>
>
> At this point, you can't. It has to do with differences between how PHP
> handles INI files and how it handles XML. I believe there's an issue in
> the tracker already regarding this, but the solution to it looks to be
> fairly tricky.
>
>
>> For example, I would like to specify:
>>
>> <production>
>>       <bootstrap>
>>               <path>APPLICATION_PATH . /Bootstrap.php</path>
>>       </bootstrap>
>> </production>
>>
>> But this does not work. The value production->bootstrap->path is
>> treated as a string:
>>
>> "Warning: require_once(APPLICATION_PATH . /application/Bootstrap.php) [...]"
>>
>> Similarly, I would like to set the error_reporting level:
>>
>> <production>
>>       <phpSettings>
>>               <error_reporting>E_ALL|E_STRICT</error_reporting>
>>       </phpSettings>
>> </production>
>>
>> But again, the constants are treated as strings and consequently are not set.
>>
>> Is it at all possible to work around these issues but still use XML to
>> store application settings?
>>
>> I am using Zend Framework 1.8.2 (same behavior in 1.8.1).
>>
>> Thank you in advance.
>>
>> Jonathan Maron
>>
>
> --
> Matthew Weier O'Phinney
> Project Lead            | [email protected]
> Zend Framework          | http://framework.zend.com/
>

Reply via email to