Hi Mon,
Thanks very much :-) Worked great! Quick question, should the following code:
$this->addHelperPath('../application/views/helpers/', 'My_View_Helper');
be called in the view index.phtml file, or should it be called in bootstrap or a controller file? If so, how? (e.g. how do I reference the view, if it were on the bootstrap?)
It's not a big deal at the moment but I just want to follow the standard.
Many thanks,
Rishi
Thanks very much :-) Worked great! Quick question, should the following code:
$this->addHelperPath('../application/views/helpers/', 'My_View_Helper');
be called in the view index.phtml file, or should it be called in bootstrap or a controller file? If so, how? (e.g. how do I reference the view, if it were on the bootstrap?)
It's not a big deal at the moment but I just want to follow the standard.
Many thanks,
Rishi
From: Mon Zafra <monzee@gmail.com>
To: fw-mvc@lists.zend.com
Sent: Mon, August 9, 2010 5:41:33 PM
Subject: Re: [fw-mvc] View Helper classes - help! 'Plugin by name... not found in the registry'
The second argument to addHelperPath should just be 'My_View_Helper'.
-- Mon
On Mon, Aug 9, 2010 at 7:58 PM, Rishi Daryanani <rishijd@yahoo.com> wrote:
Hi all,
This is probably an easy one but I am really confused. I am trying to use a helper for the first time on my zend-framework based site, and I've followed the example on
http://devzone.zend.com/article/3412
My new helper is called CoremetricsTags.php, and it is in the /application/views/helpers/ directory,
and it has the following code (sample):
[PHP]
require_once 'Zend/View/Helper/Abstract.php';
class My_View_Helper_CoremetricsTags extends Zend_View_Helper_Abstract {
public function coremetricsTags()
{
// build the element
$xhtml = 'test';
return $xhtml;
}
}
[/PHP]
My view index.phtml is calling the helper as follows as a test:
[PHP]
$this->coremetricsTags("coremetrics");
[/PHP]
And this generates an error from the error.phtml file, as follows:
Message: Plugin by name 'CoremetricsTags' was not found in the registry; used paths: My_View_Helper_CoremetricsTags_: ../application/views/helpers/ Zend_View_Helper_: Zend/View/Helper/:../application/views/helpers/
I'm not sure why it happens. I'm a little confused by the addHelperPath and where to use it, but I did do this but it didn't solve the problem (no real effect):
[PHP]
$this->addHelperPath('../application/views/helpers/', 'My_View_Helper_CoremetricsTags');[/PHP]
Can anyone help?
Many thanks,
Rishi
没有评论:
发表评论