Here is how you can use a custom view helper inside another custom view helper in Zend Framework 1 applications.

All you need to do is to create this method in your view helper

1
2
3
4
public function setView(Zend_View_Interface $view)
{
    $this->_view = $view;
}

Here is a full example on how to use this.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
class Zend_View_Helper_MyFirstViewHelper extends Zend_View_Helper_Abstract
{
  protected $view;

    public function MyFirstViewHelper()
    {
      // Calling another view helper
      $this->_view->AnotherViewHelper();
    }

    public function setView(Zend_View_Interface $view)
  {
      $this->_view = $view;
  }
}

Comments