2009年10月28日星期三

Re: [fw-mvc] how to use APPLICATION_ENV

I, like Brenton, don't prefer to have to deal with the APPLICATION_ENV.

I usually have three different environments (dev/staging/production) where I will create a server.xml and place it in my global include_path.

In the bootstrap I grab the value for the environment and pass it to the frontcontroller:

$server       = new Zend_Config_Xml(SERVER_PROPERTIES, 'properties');

Just pass: $server->environment to boostrap

On Wed, Oct 28, 2009 at 7:19 PM, Brenton Alker <brenton@tekerson.com> wrote:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hector Virgen wrote:
> The default error.phtml created by zf.sh tests the APPLICATION_ENV
> constant to determine if exception information should be displayed. If
> it's set to "development", then exception information is displayed. Is
> there a better way for it to determine this without using the constant?

Ah, true.
Personally, I don't like checking for a specific environment, but would
rather check for a configuration directive.

eg. I would add a "debug" configuration option to the development
environment config and check for that.

That way, you could add it to other environments, or remove it from that
environment without editing the code. Basically, I try not to depend on
the constant for anything.

Having said that, this is just my opinion, and since it's used in the
error page, somebody apparently disagrees :)


- --

Brenton Alker
PHP Developer - Brisbane, Australia

http://blog.tekerson.com/
http://twitter.com/tekerson

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkro33EACgkQ7bkAtAithuvPrwCgzk2F+EDSyZho0zlvriIh968f
hLQAn0LDjzbFBW0dS/Hwf20SrdZtDZlq
=ZY8h
-----END PGP SIGNATURE-----




--
Cory Wiles
kwylez@gmail.com
www.corywiles.com | www.feedfootball.com

没有评论: