Created
May 17, 2009 14:02
-
-
Save davidreuss/113014 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class Helper_ActionCache extends Zend_Controller_Action_Helper_Abstract { | |
public function preDispatch() { | |
$this->fire('pre'); | |
} | |
public function postDispatch() { | |
$this->fire('post'); | |
} | |
protected function fire($when) { | |
$req = $this->getRequest(); | |
$actionName = $req->getActionName(); | |
$this->getResponse() | |
->appendBody("<p>Action: $when $actionName</p>\n"); | |
} | |
} | |
class IndexController extends Zend_Controller_Action | |
{ | |
public function init() | |
{ | |
$helper = $this->_helper->getHelper('actionCache'); | |
} | |
public function indexAction() | |
{ | |
} | |
} | |
// views/scripts/index.phtml | |
// ------------------------- | |
Content | |
// ------------------------- | |
// Output from script: | |
// ------------------- | |
Action: pre index | |
Action: post index | |
Content... | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment