A couple thoughts, 1. the request object does not appear to be available until after a $front_controller->dispatch() call
2. there is a function that returns the controllers directory $front_controller->getControllerDirectory($modulename optional) However, neither is available (in my code) until after the dispatch call. It then becomes accessable in the IndexController functions. Something like this ... define('APPDIR', realpath(dirname(__FILE__).'/../').'/application'); $controller = Zend_Controller_Front::getInstance(); $controller->addModuleDirectory(APPDIR.'/modules'); $controller->setParam('noViewRenderer', true); $controller->throwExceptions(true); $controller->dispatch(); The modules directory contains: news -- controllers --- IndexController (news_index) default -- controllers --- IndexController (index) admin -- controllers --- IndexController (admin_index) Then in the IndexController.. $cDir = $this->getFrontController()->getControllerDirectory($this->_getParam('module ')); $cDir equals: Testsite/ string(54) "/home/tbnlogin/application/modules/default/controllers" Testsite/news string(51) "/home/tbnlogin/application/modules/news/controllers" Testsite/admin string(51) "/home/tbnlogin/application/modules/admin/controllers" This was the only way I could find to provide me with the current module directory. I can now trim off the "controller" directory name $this->getFrontController()->getModuleControllerDirectoryName() and replace it with templates or some other directory to be contained under the module directory. In my case the plan is to pass the directory to a custom smarty/view to allow for a global templates directory and a module specific directory. Or at least thats the plan... Terre -----Original Message----- From: Jurriën Stutterheim [mailto:[EMAIL PROTECTED] Sent: Tuesday, March 18, 2008 10:28 AM To: fw-general List Subject: [fw-general] Re: [fw-mvc] Get module directory? Here you go :-) http://framework.zend.com/issues/browse/ZF-2910 On Mar 18, 2008, at 2:28 PM, Matthew Weier O'Phinney wrote: > -- Jurriën Stutterheim <[EMAIL PROTECTED]> wrote (on Tuesday, 18 > March 2008, 01:58 PM +0100): >> Getting the module directory can be used for access to the :module/ >> models directory, or custom directories inside the module directory. >> E.g. >> :module/forms , :module/config (for module specific configs) >> >> Of course it's easy to do dirname($controllerDirectory), but it would >> be more convenient to have the module directory available from a >> method inside the frontcontroller. >> >> Suggestion for the method signature in the front controller: >> >> public function getModuleDirectory($module = null); >> >> It returns the module directory for the current module, unless >> $module is specified. In that case it would return the module >> directory for the specified $module. > > > That makes sense -- and particularly in light of the proposed > ModelLoader action helper. Cut and paste that into an issue for the > issue tracker, please. :-) > > >> Op Di, maart 18, 2008 13:19 schreef Matthew Weier O'Phinney: >>> -- thurting <[EMAIL PROTECTED]> wrote (on Monday, 17 March 2008, >>> 11:01 PM -0700): >>> >>>> Is the only way to quickly get the current module directory through >>>> ViewRenderer::getModuleDirectory()? I see why it's there, but it >>>> feels like a strange place for it. >>> >>> That's actually a convenience method for the following, simplified, >>> code: >>> >>> >>> $front = Zend_Controller_Front::getInstance(); >>> $request = $front->getRequest(); >>> $dir = $front->getControllerDirectory($request->getModuleName()); >>> >>> >>> The ViewRenderer needs to determine the current module directory >>> dynamically in order to set view script paths. No other shipped >>> components need such functionality, and so it's self-contained in >>> the ViewRenderer. >>> >>> >>> What do you need this functionality for in a more general sense? >>> >>> >>> -- >>> Matthew Weier O'Phinney >>> PHP Developer | [EMAIL PROTECTED] >>> Zend - The PHP Company | http://www.zend.com/ >>> >>> >>> >> >> > > -- > Matthew Weier O'Phinney > PHP Developer | [EMAIL PROTECTED] > Zend - The PHP Company | http://www.zend.com/ > >