that, though implementing it may become complex!
Personally I like to keep all my admin actions within my public
controllers and use ACL to manage the access to them. To get a
separate admin layout I match uri's with admin/ and then set a context
that switches the layout template.
So in my router I have:
$router = $this->_front->getRouter();
// Admin context route
$route = new Zend_Controller_Router_Route(
'admin/:module/:controller/:action',
array(
'action' => 'index',
'controller' => 'admin',
'module' => 'storefront',
'isAdmin' => true
)
);
$router->addRoute('admin', $route);
then I have a front controller plugin that switches the context for me:
class SF_Plugin_AdminContext extends Zend_Controller_Plugin_Abstract
{
public function preDispatch(Zend_Controller_Request_Abstract $request)
{
if($request->getParam('isAdmin')) {
$layout = Zend_Layout::getMvcInstance();
$layout->setLayout('admin');
}
}
}
2008/12/14 angelbit <angelbit88@gmail.com>:
>
> admin is not a mobule but a container for modules...
>
> keith Pope-4 wrote:
>>
>> Sounds like you need to add a route, maybe something along the lines of:
>>
>> $router = $this->_front->getRouter();
>>
>> // Admin route
>> $route = new Zend_Controller_Router_Route(
>> 'admin/:controller/:action',
>> array(
>> 'action' => 'index',
>> 'controller' => 'admin',
>> 'module' => 'admin'
>> )
>> );
>>
>> $router->addRoute('admin', $route);
>>
>> This should route anything that matches /admin to your admin module.
>>
>> 2008/12/14 angelbit <angelbit88@gmail.com>:
>>>
>>> Hi
>>> I'm developing a cms where the modules have controller for the admin
>>> section
>>> and the public section.Now need that when the user go on url:
>>> /admin/:module/:controller/:action the dispatcher load the admin
>>> controller
>>> (Admin_pageController.php for example) and when is the public
>>> url(:module/:controller/:action) the dispatcher load the public
>>> controller.
>>> how? subclass the dispatcher or else?
>>>
>>> I thank you in advance
>>> --
>>> View this message in context:
>>> http://www.nabble.com/CMS-supermodule-design-tp21000480p21000480.html
>>> Sent from the Zend MVC mailing list archive at Nabble.com.
>>>
>>>
>>
>>
>>
>> --
>> ----------------------------------------------------------------------
>> [MuTe]
>> ----------------------------------------------------------------------
>>
>>
>
> --
> View this message in context: http://www.nabble.com/CMS-supermodule-design-tp21000480p21000694.html
> Sent from the Zend MVC mailing list archive at Nabble.com.
>
>
--
----------------------------------------------------------------------
[MuTe]
----------------------------------------------------------------------
没有评论:
发表评论