$this was referencing the template engine not the view class where $t is the view class. A template variable like {myHelper():h} would be compiled back as $t->myHelper(), however because it compiles with the method_exists it never gets run because there is no method like that in the view class itself rather it gets set in the call, so im needing to work that one out. My problem now is getting all these helpers to be able to get session variables from a particular session namespace in the registry, I guess i send it as a variable to the view class ?

Keith Pope wrote:
Hi,

I use a custom view class that inherits from the Zend_View. I haven't had any 
problems with calling helpers using $this->Helper(); Maybe looking at the 
Zend_View __call() would help?

In my helpers I use:

Public $view;
    /**
     * Internal used by zend_view, to send
     * a reference of the view to the helper.
     *
     * @param view $view
     */
    public function setView( $view )
    {
        $this->view = $view;
}
Zend_View then sets a reference to view in the helper so I can access the view 
class variables.

Not sure if this is what you mean but I hope it helps :)

Keith Pope
Web Developer

-----Original Message-----
From: Dan Rossi [mailto:[EMAIL PROTECTED] Sent: 07 August 2007 14:31
To: [email protected]
Subject: Re: [fw-general] View helper problem

Thanks matt sorry about that. Ive implemented a custom View class for rendering 
pear's html_template_flexy templates as its more designer friendly. Im having an 
issue there where its compiling its templates with method_exists so call doesnt get 
run. When i try $this->method $this is calling the template class , it seems $t is 
compiled as the view pointer so $t->method() works.

My problem with these helper classes now though is, i needed these methods to 
output things like a custom image or button image. But these are reliant on some 
session variables, so i guess i have to get the session from the $this->view 
class which i set it from a registry correct ?

Matthew Weier O'Phinney wrote:
-- Dan Rossi <[EMAIL PROTECTED]> wrote (on Tuesday, 07 August 2007, 11:06 PM +1000):
Hi ive gone through all the documentation to create a view helper, so i can call some methods in the view scripts however call never gets run , im still getting this "Call to undefined method"
Hard to diagnose without the following:

  * the view helper
  * a view script where you attempt to call the view helper

Please provide these, and I'll see if I can diagnose the issue.






Reply via email to