I'm currently trying out phalcon for the first time for a small static webpage + forms project.
I use the
IndexController and have one action for each (currently static) route. I also have an
addScripts() method inside the
$this->assets->addCss() which are then output inside the main template via
<? $this->assets->outputCss(); ?>
So far so good. Now I want to run the
addScripts() method for each action, without having to copypaste the
$this->addScripts() call into each action method.
My first try was extendind the
__construct() method of the
ControllerBase class, which is final. So that doesn't work.
Then I checked out how events work, but this might be a little too much, as I might only want to inject the scripts in certain Controller classes, or at least have control over when exactly I inject those.
What would be the best solution?