-- helderfelipe <[email protected]> wrote
(on Monday, 13 April 2009, 03:12 PM -0700):
> 
> it doesn't work:
> 
> Fatal error: Call to a member function foo() on a non-object 

Create a class like this:

    Class My_View_Helper_Foo extends Zend_View_Helper_Abstract
    {
        public function foo()
        {
            return $this;
        }
    
        public function bar()
        {
            return 'foo bar!';
        }
    }

Register the view helper path with the view:

    $view->addHelperPath('My/View/Helper/', 'My_View_Helper');

And in your view script:

    echo $this->foo()->bar();

will result in:

    foo bar!

-- 
Matthew Weier O'Phinney
Software Architect      | [email protected]
Zend Framework          | http://framework.zend.com/

Reply via email to