The "pluginPaths" option allows you specify *prefixes* to your bootstrap
resource plugins. So you'll want something like this:
pluginPaths.My_Resource = "My/Resource"
And you would create your resource plugin here:
My/Resource/Frontcontroller.php
And the class would look something like this:
class My_Resource_Frontcontroller extends
Zend_Application_Bootstrap_Resource_Frontcontroller
{
public function init()
{
parent::init();
}
}
You'll also need to ensure that the class can be autoloaded. In this case,
you'll need to add this line to your application.ini:
autoloadernamespaces[] = "My_"
And lastly the directory that contains the "My" directory should be in your
include path. One such place might be the "library" folder in your
application.
I hope this helps!
--
*Hector Virgen*
Sr. Web Developer
http://www.virgentech.com
On Thu, May 5, 2011 at 4:35 AM, Simon Walter <[email protected]> wrote:
> 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: [email protected]
> Info: http://framework.zend.com/archives
> Unsubscribe: [email protected]
>
>
>