class My_View_Helper_Gender extends Zend_View_Helper_Abstract
{
public function Gender()
{
//
}
}
"The class method (Gender()) must be named identically to the concliding part
of your class name(Gender).Likewise,the helper's file name must be named
identically to the method,and include the .php extension(Gender.php)"
(Easyphp websites J.Gilmore)
My question is:
Can A view Helper contain more than one method?And can I call other view helpers from within my helper?
thanks
Luca
Yes, helpers can contain additional methods. To call them, you have to get hold of the helper instance. This can be achieved either by getting a helper instance in the View
or by having the helper return itself from the main helper method:
and then call
$this->gender()->otherMethod()Because View Helpers contain a reference to the View Object, you can call any available View Helpers from within a View Helper as well, e.g.