What is a Zend View filter?

What is a Zend View filter? I see them in the ZF1 documentation, http://framework.zend.com/manual/1.12/en/zend.view.introduction.html and in the Zend_View code, but I can not find an explanation for them.

Perhaps this is support for other template systems that have filters? In this case, what are the filters in these template systems doing?

Thanks!

+7
source share
1 answer

here is an example of a Zend View filter:

http://dev.bigace.org/api/3.0/Bigace_Zend/View_Filter/Bigace_Zend_View_Filter_ObfuscateMailto.html

It filters the found mailto links and obfuscates them.

The Zend View filter does something in the already processed phtml file (= html code) before sending it to the client.

This is a Zend_Filter that can be used to display Zend View.

Here is another code example:

http://www.phpgangsta.de/zend_view-output-filter-whitespaces-aus-html-entfernen

Filter class (filters spaces from html = less code to send):

 <?php class App_View_Filter_Minify implements Zend_Filter_Interface { public function filter($string) { return preg_replace( array('/>\s+/', '/\s+</', '/[\r\n]+/'), array('>', '<', ' '), $string ); } } 

Then add a filter to the view:

 /** * Add Output filters to View * * @return void */ protected function _initViewFilter() { $view = $this->getResource('view'); $view->addFilterPath('App/View/Filter', 'App_View_Filter_') ->addFilter('Minify'); } 
+7
source

All Articles