В 09:57 +1000 на 04.11.2009 (ср), Brenton Alker написа:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> Simeon Goranov wrote:
> > Hello,
> > I've got a module bootstrap file Admin_Bootstrap where the module is
> > "admin". I'm wondering how to change the default layout, which in my
> > case is layout.phtml only for the admin module. In my opinion I have to
> > do it into the bootstrap file, because in this way the change will
> > affect all of the module controllers. Do you have any idea how to solve
> > the problem ?
> 
> You can't do it in your bootstrap as has been suggested by others. The
> bootstrap for *all* modules is run for *all* requests; even if the
> default module is requested, the admin bootstrap is still run. At the
> bootstrap stage routing has not yet been done, so the module being
> requested has not yet been determined. So, if you change the layout in
> any bootstrap it will be changed for every module.
> 
> The most common solution I've seen to this is to use a pre-dispatch
> front controller plugins or action helper. Both of these will allow you
> to check the current request after routing and take the necessary steps
> to change the layout.
> 

Thanks for the code ! 
I'm wondering what to do if I've got code which is specific for one the
modules. I mean something like checking for authorization in admin
module, for example. What is the best practice to resolve this
situation ?
Using plugins, extend each of the controllers from admin with a class
like Admin_Bootstrap_Controller or there is another solutions ?

Regards,
S.G. 


> - --
> 
> 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
> 
> iEYEARECAAYFAkrww2MACgkQ7bkAtAithus/rACfekgNOHJGmuOtuSC1UjFwMYLY
> GuQAniCsI0NM2PMTB7UbxPQtL8euVcIV
> =f7m9
> -----END PGP SIGNATURE-----


Reply via email to