-- Jack Sleight <[EMAIL PROTECTED]> wrote
(on Friday, 03 August 2007, 03:00 PM +0100):
> Great thanks, I'll do that for now. Would be handy to have it built in.

I've added it to the tracker:

    http://framework.zend.com/issues/browse/ZF-1808

and there's a better implementation of loadClass() there for you to use
than the one I provided below.


> Matthew Weier O'Phinney wrote:
> 
>     -- Jack Sleight <[EMAIL PROTECTED]> wrote
>     (on Friday, 03 August 2007, 02:40 PM +0100):
> 
> 
>     You'll need to subclass the dispatcher, and override the
>     loadClass($className) method. The following should do it:
> 
>         public function loadClass($className)
>         {
>             $dispatchDir = $this->getDispatchDirectory();
> 
>             $loadFile    = $dispatchDir . DIRECTORY_SEPARATOR . 
> $this->classToFilename($className);
>             $dir         = dirname($loadFile);
>             $file        = basename($loadFile);
> 
>             try {
>                 Zend_Loader::loadFile($file, $dir, true);
>             } catch (Zend_Exception $e) {
>                 require_once 'Zend/Controller/Dispatcher/Exception.php';
>                 throw new Zend_Controller_Dispatcher_Exception('Cannot load 
> controller class "' . $class
>             }
> 
>             $className = $this->formatModuleName($this->_curModule) . '_' . 
> $className;
> 
>             if (!class_exists($className)) {
>                 require_once 'Zend/Controller/Dispatcher/Exception.php';
>                 throw new Zend_Controller_Dispatcher_Exception('Invalid 
> controller class ("' . $classNam
>             }
> 
>             return $className;
>         }
> 
>     It's a minor change from the current dispatcher, and I'm thinking it
>     might be good to have a flag for 'alwaysUseModulePrefix' that would make
>     this behaviour possible. What do others think?

-- 
Matthew Weier O'Phinney
PHP Developer            | [EMAIL PROTECTED]
Zend - The PHP Company   | http://www.zend.com/

Reply via email to