To extend the Front Controller, at the very minimum you will need
to override the getInstance() method:
<?php
class My_Controller_Front extends Zend_Controller_Front
{
public static function getInstance()
{
if (null === self::$_instance) {
self::$_instance = new self();
}
return self::$_instance;
}
}
Overriding the getInstance() method ensures that
subsequent calls to
Zend_Controller_Front::getInstance() will return an
instance of your new subclass instead of a
Zend_Controller_Front instance -- this is particularly
useful for some of the alternate routers and view helpers.
Typically, you will not need to subclass the front controller unless you need to add new functionality (for instance, a plugin autoloader, or a way to specify action helper paths). Some points where you may want to alter behaviour may include modifying how controller directories are stored, or what default router or dispatcher are used.




