Sorry to all about multiple mails but Nabble keeps telling me to re-send ... So I did! I'll stop now :-)
-----Original Message----- From: Julian Davchev [mailto:[EMAIL PROTECTED] Sent: 19 March 2008 15:59 To: rcastley Cc: [email protected] Subject: Re: [fw-general] Zend_Translate and Zend_View_Helper_* question? Is it just me or you sent same mail 3 times. Ok, extending View is definately not a good idea. at worst you should do Zend_Registry::get('Zend_Translate'); other thing you could do is have one common helper that all your view helpers extend and on init() this helper sets Zend_Translate...so that each view helper out have it. Might be better approach...this just comes to mind now. rcastley wrote: > Hi All, > > > Hoping someone can help me out here. > > I have just upgraded to ZF 1.5 and have discovered that Zend_Translate > can be made available to views by setting a registry entry and then > using > $this->translate('langString') in my views. > > I have created some helpers that I include in my views using e.g. > > echo $this->myHelper(); > > In my Helper I have the following: > > class Zend_View_Helper_MyHelper > { > public function myHelper() > { > $s = "Hello World!"; > $s .= $this->translate('myString'); > > return $; > } > } > > When this is run I will get an error in my view stating: Call to > undefined method Zend_View_Helper_MyHelper::translate() ... > > Now, I can seem to fix this by changing the class line above to read: > > class Zend_View_Helper_MyHelper extends Zend_View > > My question is, is this correct or should I be going about things a > completely different way? > > Many thanks in advance. > > - Robert > ________________________________________________________________________ This email has been scanned for all known viruses by the MessageLabs Email Security Service and the Macro 4 plc internal virus protection system. ________________________________________________________________________ ________________________________________________________________________ This email has been scanned for all known viruses by the MessageLabs Email Security Service and the Macro 4 plc internal virus protection system. ________________________________________________________________________
