This shows you the differences between two versions of the page.
filters [2009/09/23 09:24] Kornel created |
filters [2013/05/24 08:58] (current) |
||
---|---|---|---|
Line 47: | Line 47: | ||
Is that easy to use? Powerful enough? What do you think? | Is that easy to use? Powerful enough? What do you think? | ||
+ | |||
+ | ===== Suggested improvements ===== | ||
+ | |||
+ | [[http://lists.motion-twin.com/pipermail/phptal/2009-September/001865.html|link]] [[http://lists.motion-twin.com/pipermail/phptal/2009-September/001871.html|prototype]] | ||
+ | |||
+ | The API looks ok to me, just one thing, since it's not a runtime operation | ||
+ | (in the sense that a php file is generated for the template), I think it'll | ||
+ | be great if it used something along the lines of Zend_Loader_PluginLoader. | ||
+ | |||
+ | Which basically when setup with paths and class prefixes is able to find | ||
+ | "plugins" in several folders. This would allow to have a set of default | ||
+ | filters in PHPTAL distribution but override them and create new ones easily | ||
+ | just by placing the class files in a directory, not needing to register them | ||
+ | manually at runtime, which once the template is compiled, is of no use. | ||
+ | |||
+ | So -- ''phptal:filter="remove_whitespace"'' -- would automatically try to | ||
+ | include and instantiate a class for that filter. | ||
+ | |||
+ | While -- ''%%PHPTAL->addPreFilter("remove_whitespace")%%'' -- would just store the | ||
+ | name for when compiling the template and instantiate the class then. | ||
+ |