I would like to know the differences between two helpers Zend_Controller_Action_Helper_Abstract and Zend_View_Helper_Abstract in Zend framework which I did not understand.
I would like to know the differences between two helpers Zend_Controller_Action_Helper_Abstract and Zend_View_Helper_Abstract in
Share
Like their names suggest:
An ActionHelper is for reusable functionality needed in the actions of your Controllers, while a ViewHelper is for reusable functionality in your View Templates.
From http://zendframework.com/manual/en/zend.controller.actionhelpers.html
From http://zendframework.com/manual/en/zend.view.helpers.html
The main idea is to encapsulate often used functionality into objects, instead of recreating that functionality over again or using inheritance for it (which would bloat the base class and violate the Single Responsibility Principle). ZF distinguishes between ViewHelpers and ActionHelpers because they have different responsibility. ActionHelpers are used in helping handling a request, while ViewHelpers are used in helping rendering the model.