I want to add more than one function to a ViewHelper. Usually there is one function named like the class and like the file name.
How can I add several functions into one ViewHelper?
E.g. like this:
class Zend_View_Helper_MyMenuHelper extends Zend_View_Helper_Abstract
{
public function Horizontal($parameter)
{
return "...";
}
}
echo $this->MyMenuHelper()->Horizontal($parameter);
Alex was on the right path, but missed something in his answer: the actual myMenuHelper()
method has to return the view helper itself, for this to work:
class Zend_View_Helper_MyMenuHelper extends Zend_View_Helper_Abstract
{
public function myMenuHelper()
{
return $this;
}
public function horizontal() { ... }
// more methods...
}
And then, as mentioned:
echo $this->myMenuHelper()->horizontal();