I need to send an email via Zend_Mail
within my IndexController
. Instead of setting up the body of my email in a variable, I'd rather use another view. Here's how I call my view in the controller:
$view = new Zend_View();
$view->addScriptPath(APPLICATION_PATH.$this->getRequest()->getModuleName().DS.'views'.DS.'scripts'.DS.'email')
->setHelperPath(LIB_PATH.'Ms'.DS.'View'.DS.'Helper');
$view->subscription = $subscription;
I then configure the email and send it like so:
$mail = new Zend_Mail('UTF-8');
$mail-> // ...
->setBodyHtml($view->render('checkout.phtml'))
->send();
In scripts/email/checkout.phtml
I use two view helpers which work perfectly fine when called in the default view of the controller. But not anymore when used in checkout.phtml
.
I used both $this->price($myTotal)
and $this->getHelper('Price')->price($myTotal)
and none of them work.
The error I get is : Plugin by name 'Price' was not found in the registry; used paths: Zend_View_Helper_: Zend/View/Helper/;C:\wamp2.4\www\abo\library\Ms\View\Helper/
. The weirdest thing being that it goes looking for helper in the right directory but can't find it.
Any thoughts/ideas?
Many thanks!
I had to set helper path by adding a second argument like so:
$view = new Zend_View();
$view->setHelperPath(LIB_PATH.'Ms'.DS.'View'.DS.'Helper', 'Ms_View_Helper');