The error you are receiving is that a view helper cannot be found with the name "currency".
Are you sure that Currency.php exists in the /Zend/View/Helper directory?
Do any other view helpers work in your project, such as $this->url()?
Konr
On Thu, Jan 28, 2010 at 2:50 PM, Nathan Garlington <garlinto@gmail.com> wrote:
I have been trying to implement the view currency helper using the
example in the manual. I have created a resource with the following
code:
class My_Bootstrap_Resource_Currency extends
Zend_Application_Resource_ResourceAbstract
{
public function init()
{
Zend_Registry::set('Zend_Currency', new Zend_Currency('en_US'));
}
}
In my application.ini, I added this line:
resources.currency = true
As per the example in the manual, I should now be able to use the helper thusly:
<?php
// view script
echo $this->currency(1342.67);
?>
However, i get this error:
Message: Plugin by name 'Currency' was not found in the registry; used
paths: Zend_Dojo_View_Helper_: Zend/Dojo/View/Helper/
Zend_View_Helper_:
Zend/View/Helper/:/home/garlinto/frontend/views/helpers/
So I thought, maybe the resource isn't being invoked. So in the
controller I ran this code:
$currency = Zend_Registry::get('Zend_Currency');
$this->view->debug = Zend_Debug::dump($currency, "Currency:", false);
And the response is:
Currency: object(Zend_Currency)#43 (2) {
["_locale:private"] => string(5) "en_US"
["_options:protected"] => array(8) {
["position"] => int(8)
["script"] => NULL
["format"] => NULL
["display"] => int(2)
["precision"] => int(2)
["name"] => string(9) "US Dollar"
["currency"] => string(3) "USD"
["symbol"] => string(1) "$"
}
}
Anyone know what I am doing wrong? I'm sure I'm missing something...
--regards,
Nathan Garlington
没有评论:
发表评论