0
votes

I have created one plugin that is reside in application/controllers/plugin/view.php and below is its content

class Application_Controller_Plugin_View extends Zend_Controller_Plugin_Abstract
{
    public function dispatchLoopStartup(Zend_Controller_Request_Abstract $request)
    {
        $frontController = Zend_Controller_Front::getInstance();
        $view = $frontController->getParam('bootstrap')->getResource('view'); 
        echo 'erace';
        exit;
        $view->doctype('XHTML1_STRICT');

        $baseUrl = $request->getBaseUrl();
        if (defined('RUNNING_FROM_ROOT')) {
            $baseUrl .= '/public'; 
            $frontController->setBaseUrl($baseUrl); 
        }
      /*  $view->headLink()->appendStylesheet($baseUrl . '/css/main.css');
        $view->headLink()->appendStylesheet($baseUrl . '/css/screen.css', 'screen');
        $view->headLink()->appendStylesheet($baseUrl . '/css/print.css', 'print');*/
    }   
}

Then I have registered this plugin in bootstrap as follow :

protected function _initLayoutHelper()
    {

        $front = Zend_Controller_Front::getInstance();
        $front->registerPlugin(new Application_Controller_Plugin_View());       

    }

but its give me an error like

( ! ) Fatal error: Class 'Application_Controller_Plugin_View' not found in C:\wamp\www\saet_new\application\Bootstrap.php on line 42

Please help me.

2
Any specific reason you are using a plugin for this rather than a custom view application resource (or even just configuring the standard view application resource with params set in application.ini)?David Weinraub

2 Answers

2
votes

Is the plugin here:

library/application/controller/plugin/view.php

?

Custom code belongs in the library folder in my opinion, and that path is already defined in index.php

I register my namespaces in the bootstrap as follows:

$autoLoader = Zend_Loader_Autoloader::getInstance();
$autoLoader->registerNamespace('Custom_');

Then library code can be put in the folder library/custom

1
votes

I think it's caused because you are calling Default_Application_Controller_Plugin_View and you're plugin is Application_Controller_Plugin_View.

Are you using modules at all? that would explain why the Default_ would be there, although I believe the prefix isn't required unlesss prefixDefaultModule is set.