i wanted to send variables to the layout in zend framework for which i tried creating a controller plugin and placed it in
application
/plugins
and named the file as layout.php, here is the code from layout.php
class Plugin_Layout extends Zend_Controller_Plugin_Abstract
{
public function preDispatch(Zend_Controller_Request_Abstract $request)
{
$layout = Zend_Layout::getMvcInstance();
$view = $layout->getView();
$view->foo = 'bar';
}
}
now i wanted to register the plugin with the frontController in application.ini for which i tried adding
includePaths.plugin = APPLICATION_PATH "/plugins"
autoloaderNamespaces[] = "Plugin_"
resources.frontController.plugins[] = "Plugin_Layout"
it shows me following error.
Warning: include_once(Plugin/Layout.php) [function.include-once]: failed to open stream: No such file or directory in /Users/azhararmar/htdocs/joofris/library/Zend/Loader.php on line 146
i am new to zend framework. where am i going wrong?
Add in your application.ini:
Rename
resources.frontController.plugins[] = "Plugin_Layout"toresources.frontController.plugins.Layout = "Plugin_Layout"butfrontController.plugins[]should work anyway.and rename your plugin folder to Plugins and your layout.php file to Layout.php, this should work.