Tuesday, February 15, 2011

Re: How to define a global constant which is available through whole app?

Umm if you want a 'constant' why not use constant()? http://php.net/constant
And if you need a constant on a class, why not use a class constant?

Like AD7six said, CakePHP doesn't not stop you from using regular
PHP. Also as an aside, Configure does not make constants..

-Mark

On Feb 15, 7:52 pm, Miles J <mileswjohn...@gmail.com> wrote:
> Like AD7 said, you cant use functions on class properties. Do it in
> the constructor.
>
> On Feb 15, 3:36 pm, Alejandro Gómez Fernández <agom...@gmail.com>
> wrote:
>
>
>
>
>
>
>
> > -----BEGIN PGP SIGNED MESSAGE-----
> > Hash: SHA1
>
> > Another way to do this is using session variables, in this case, a
> > constant. You can always access this var in every module.
>
> > Alejandro.
>
> > El 15/02/2011 10:52, sanjibdhar...@gmail.com escribi :
>
> > > I tried Configure::write('company', 'xxx);  in bootstrap.php and to
> > > access the constant I wrote
> > > var $company = Configure::read('company'); in AppController but it
> > > gives syntax error.Can somebody tell me how to access the constant or
> > > there is another way of to define a global constant through whole app.
>
> > -----BEGIN PGP SIGNATURE-----
> > Version: GnuPG v1.4.11 (MingW32)
> > Comment: Using GnuPG with Mozilla -http://enigmail.mozdev.org/
>
> > iQEcBAEBAgAGBQJNWw3oAAoJEHQn9CmeN9DJjAkH/2wj9WUQsjAxsr/AacdUT2BP
> > 0dwi9JE7otI/UBpPcEYzax6OfQBGn4MtT4vGv6DOoz6gzQtufg8ZGHPw5Gq0wLzx
> > ICqszm8+PbQCZd3+ht/V5yjuLWYNXJ+zCCGSaBCtZxk0LfEKJ41+enxxxNBf+jL+
> > 2Wr7x4kWf1wN0I1UaHicKKYhMLrID/mj/SIeMQK0WiQO2E2eCyq9XtU2iUQwUWEY
> > OhLRz+GnUvQMn1vXtT3H8fkAkyj36Stx6+Pox7G2/gchM2slljC3UgDVNyeKPQu6
> > RQ5ANsW4WLTA2Ey4Qz8+beoQW/2E7dJl8r/DBuDp8k4/QqntR634tRTP0VVPSbM=
> > =XhXQ
> > -----END PGP SIGNATURE-----

--
Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.


To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate