I found it best practice to not mingle admin- and user-interfaces and to
have the admin area in a single module. There all the Controller classes
extend AbstractAdminController which itself extends
Zend_Controller_Action and overwrites the init() method similar to this
public function init() {
// get session data
if (!$user->loggedIn($sess_data)) //user has to be logged in
$this->forward(
'login',
'auth',
$this->_request->getModuleName(),
array( // params for redirecting after login
"tryController"=> $this->_request->getControllerName(),
"tryAction" => $this->_request->getActionName()
));
}
Also think of a __call() method redirecting without further parameters
(the part after the modulename). in fact you can also omit the part
after 'auth'. I recommend using the FlashMessenger in this case (find
that one at
http://framework.zend.com/manual/en/zend.controller.actionhelpers.html ).
This code isn't guaranteed to work, because I'm not at my workstation :-)
You could also combine this approach using Zend_Acl for further detail
(i.e. someone always has to be logged in, but a moderator can not access
the same actions as an admin).
I don't see the need for a second bootstrap file.
Regards
Ronald
Charles Harley wrote:
> I am also wondering how best to have an admin area. So far I have setup
> the admin area as a separate module in the application but which with
> access to it being controller using Zend_Acl. I also have a different
> frontend theme for the admin area.
>
> Really not sure if this is the best way but it does save having to
> manage two different bootstrap files.
>
> Charles
>
> Greg Freeman wrote:
>> What is the best method for creating an admin area for a zend framework
>> application?
>>
>> I am looking for some examples if possible i.e do you use a module
or two
>> different bootstrap files (like some other frameworks).
>>
>> If you could provide the directory structure that you use as well that
>> would
>> be greatly appreciated.
>>
>