0

I've found the guidance here how to start with Zend Acl, going throuh the steps of the best answer but I've become stuck on this operation:

Final steps are loading your configAcl.php and register the AuthPlugin in bootstrap file (probably index.php).

When I start my application, it tells me

Fatal error: Class 'AuthPlugin' not found in C:\Program Files (x86)\Apache Software Foundation\Apache2.2\htdocs\myproject\public\index.php on line 28

but I have put this plugin in applications/plugins folder. I'm new to Zend Framework and using v.1.12 (because I didn't find out how to create project in new version: the command-line app in bin folder was missing).

Maybe I have to edit my Bootstrap.php file, but I don't know how. Every instruction I found looks like for another version of framework, because the code in their public/index.php is very different from mine.

Community
  • 1
  • 1

3 Answers3

0

So after sitting an hour I finally found out how to do it. Honestly, I would have found answer for my question faster if only my firefox didn't show me error, that my pages of the application redirects in recursion. After firefox restart problem dissappeared. So That's the answer: In your bootstrap use the following code.

class Bootstrap extends Zend_Application_Bootstrap_Bootstrap
{
protected function _initAutoload() {
    require_once '../application/plugins/AuthPlugin.php';
    require_once '../application/configs/configAcl.php';
}

protected function _initControllerPlugins()
{

$frontController = Zend_Controller_Front::getInstance();
$frontController->registerPlugin(new AuthPlugin());

}
}

Hope this helpes for such newbies in Zend Framework as I am.

0

I know it´s a really old question but I´m leaving the answer I found just in case someone stumbles upon this thread.

While the answer you posted works, I found another through application.ini. ZF follows the naming standard: Plugin_ViewSetup parses to Plugin/ViewSetup.php . For the plugin, ZF automatically looks into the "path to library", which means that it looks within the directory of your library (where your Zend library is). So the plugin should be as follows: library/Plugin/ViewSetup.php ... That´s one scenario. Then all you have to do in application.ini is add the following:

autoloaderNamespaces[] = "Plugin_"
resources.frontController.plugins.ViewSetup = "Plugin_ViewSetup"

Translated to your case would be:

autoloaderNamespaces[] = "Plugins_"
resources.frontController.plugins.AuthPlugin = "Plugins_AuthPlugin"

And your library structure should be:

library/Plugins/AuthPlugin.php

hope this helps to anyone stumbling upon here!

Chayemor
  • 3,313
  • 3
  • 26
  • 49
0

Require_once is not usable for my project .. any other way to include plugin