|
|
Callbacks with ContextSwitch Action Helper: msg#00118
php.zend.framework.mvc
|
Subject: |
Callbacks with ContextSwitch Action Helper |
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
|
|
|