2009年8月6日星期四

Re: [fw-mvc] Logic within view layout

Thanks for the reply...

I've been reading through the docs specifically "Zend_Layout Configuration
Options" and also about custom view helpers but have not got it working %-|

http://framework.zend.com/manual/en/zend.layout.options.html
http://framework.zend.com/manual/en/zend.layout.options.html

"helperClass and pluginClass must be passed to startMvc()

In order for the helperClass and pluginClass settings to have effect, they
must be passed in as options to startMvc(); if set later, they have no
affect."

--

I'm using 1.9 but not explicitly calling startMvc. In Bootstrap.php I have
inside an _init function

$this->bootstrap('view');
$view = $this->getResource('view');
$view->doctype('XHTML1_STRICT');
$view->addHelperPath(APPLICATION_PATH . '/layouts/helpers');

In application/layouts/helpers I have placed my helper class (extends
Zend_View_Helper_Abstract) e.g FooBar with fooBar() function which will
perform the logic...then in the layout.phtml I call $this->fooBar

I've tried rename the class and file to Zend_View_Helper_FooBar

I keep getting an exception though:

Message: Plugin by name 'FooBar' was not found in the registry; used paths:
Zend_View_Helper_:
Zend/View/Helper/;C:/dev/web/<myprojectdir>/application/views\helpers/

Any help much appreciated,
Declan
--
View this message in context: http://www.nabble.com/Logic-within-view-layout-tp24845215p24849047.html
Sent from the Zend MVC mailing list archive at Nabble.com.

没有评论: