Skip to content

Instantly share code, notes, and snippets.

@davidreuss
Created May 17, 2009 14:02
Show Gist options
  • Save davidreuss/113014 to your computer and use it in GitHub Desktop.
Save davidreuss/113014 to your computer and use it in GitHub Desktop.
<?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