Hello,
Can someone please show me an example of how to use callbacks with the ContextSwitch action helper? I have read the documentation at http://framework.zend.com/manual/en/zend.controller.actionhelpers.html#zend.controller.actionhelpers.contextswitch.custom but there are no examples.
I have specified bogus callbacks in my $spec array hoping to throw a descriptive exception but none was thrown. Here is my test code:
// From within an action controller
public function init()
{
$contextSwitch = $this->_helper->getHelper('contextSwitch');
$context = 'text';
$spec = array(
'suffix' => 'text',
'headers' => array(
'Content-type' => 'text/plain'
),
'callbacks' => array(
'init' => 'testinit'
'post' => 'testpost'
)
);
$contextSwitch->addContext($context, $spec);
$contextSwitch->addActionContext('view', 'text')
->initContext();
}
If the above code looks correct, where should I be defining my callbacks? Are they global functions, or methods of the current action controller, or methods of the ContextSwitch helper? Thanks!
-Hector
2008年7月21日星期一
订阅:
博文评论 (Atom)
没有评论:
发表评论