On 05/05/2011 02:35 PM, Greg wrote:
Instead of overriding the FrontController itself, you could override
the Front Controller bootstrap resource
(Zend_Application_Resource_Frontcontroller) - it should be possible to
specify the dir location for your overriding resources. Then in that
custom front controller resource class, it could be possible to
override the init() method to manipulate the controllerdirectory array
prior to calling the parent init() method, eg:

My_Resource_Frontcontroller
   extends Zend_Application_Resource_Frontcontroller
{

public function init()
{

    //bootstrap dependencies used to figure out which modules to load
   //e.g
   $db = $this->getBootstrap()->bootstrap('db');

   //controller dirs
  $controllerdirectory = array(
    'default' =>  '/modules/default/controllers'
  );

   $this->setOption('controllerdirectory', $controllerdirectory);

   parent::init(); //sets desired controller dirs in the front controller

}

}


Thanks Greg, that looks like it could work. Where would I specify to use my class (My_Resource_Frontcontroller) instead of the default (Zend_Application_Resource_Frontcontroller)?

I read here: http://blog.philipbrown.id.au/2009/06/extending-zend-framework-application-resource-plugins/ and here: http://blog.madarco.net/327/how-to-make-your-own-zend-framework-resource-plugin/
that I should add something like this to my application.ini file:

pluginPaths.My_Resource_Frontcontroller=  "My/Resource/Frontcontroller"

I also read elsewhere that the name of the resource plugin class must just end in "Frontcontroller" in order it to be used for that resource.

Is that correct?

--
List: fw-general@lists.zend.com
Info: http://framework.zend.com/archives
Unsubscribe: fw-general-unsubscr...@lists.zend.com


Reply via email to