An update on Filter Output -- advice always welcome...
Found the $view->addFilter(...) method, which does filter output. Doh.
Here's a few thoughts for those paying attention (if anybody is).
$view->addFilter('Macro');
$macro = $view->getFilter('Macro');
$macro->addPath("../{$app}/views/macros");
Feature request:
Have a way to add a filter from a constructed object e.g:
$macro = new Macro(...arguments...);
$view->addFilterObject($macro);
On the view front, since a Macro needs to do a render pass, I've ended
up creating subsclass of Zend_View_Abstract that implements a render
method that doesn't use the script search path (rather the macro search
path). If it was possible to do one of a few things:
Make _addPath() protected (rather than private) so you could add
additional path groups to a search set.
Make render() or another protected variant take a "search group"
(default 'script') for finding objects to render.
Without that support, I'm creating secondary view objects to render
against...
--koblas
David Koblas wrote:
Got it working, but it leaves a little to be desired:
Objective:
Filter the output after all rendering has happened.
Initial thoughts:
First thought:
Look at views/filters/ .. hmm, focused on Input Filtering, not
Output filtering...
-- Output filtering is a very handy thing for some views.
Second choice:
Look into Helpers .. hmm, not really in the rendering chain,
part of the rendering process.
Third choice:
Plugin .. gack. Ok, it does work. But, I'm now faced with:
IndexController {
function init() { create and initialize the plugin }
}
Why is it in the init() step (it'll probably move to the
postDispatch() step) it's because it's a per-view dependant behavior.
I can either create the filter in the main dispatch and then disable,
or enable on a case by case basis...
Final thought:
* Could it be possible to have a mechansim that is based on the
Zend_Filter system that can do output filtering of data. Is it
already in plans?
--koblas