2009年6月25日星期四

[fw-mvc] Removing default action context?

Hi,

is there a way to remove the default action context? I was experimenting a bit with the contexts and ran into following problem:

Example of my init:

    public function init()
    {
        $contextSwitch = $this->_helper->getHelper('contextSwitch');
        if (!$contextSwitch->hasContext('admin')) {
            $contextSwitch->addContext('admin', array(
                'suffix'        => '',
                'headers'       => array(),
                'callbacks'     => array(
                    'init'          => array('Amz_Controller_Action_Context_Admin', 'initAdminContext'),
                    'post'          => array('Amz_Controller_Action_Context_Admin', 'postAdminContext')
                )
            ));
        }
        $contextSwitch->clearActionContexts('test'); // no effect
        $contextSwitch->setActionContext('test', 'admin') // no effect
                      ->initContext();
    }

What I would want, is that I specify the admin context for certain actions. Trough hostname routinger ways (admin.domain.com) I'm already taken care of setting the format=admin, but I want to prevent that they load and render the page the default way. I know there are probably other ways but it seems strange to me that even if you specify that you only want context X, you still have to worry about the default context.

Tnx
Jeroen

没有评论: