Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iEYEARECAAYFAkmSm78ACgkQ7bkAtAithuvyuACfc7EB1cz8CvZMgIz6BZfJofet
dlMAnR8mChXM4z3AwiZ4rkjv9mfaNCju
=sQ1x
-----END PGP SIGNATURE-----
Jason DeBord wrote:
> If I create an object in my bootstrap file, how do I access it in a
> Controller.
>
> For example:
>
> Bootstrap:
>
> ...
>
> $locale = new Zend_Locale;
>
> ...
>
> IndexController:
>
> <?php
>
> class IndexController extends Zend_Controller_Action {
>
> public function init() {
>
> $locale->setLocale('fr_FR');
>
> }
>
> public function indexAction() {
>
>
> }
>
> }
>
> The above does not seem to work.
>
> I'm just starting to use ZF, so thanks for the help!
>
> Thanks!
>
> Jason DEBORD
> Limoges, France
The most common way is to store them in the registry:
Bootstrap:
...
$locale = new Zend_Locale;
Zend_Registry::set('locale', $locale);
...
Controller:
...
$locale = Zend_Registry::get('locale');
$locale->setLocale('fr_FR');
...
--
Brenton Alker
没有评论:
发表评论