-- Julian Davchev <[EMAIL PROTECTED]> wrote
(on Tuesday, 19 June 2007, 01:43 PM +0300):
> My structure is as follows - having default + admin module.
> 
> application
>       default/controllers/IndexController.php
> 
>       admin/controllers/IndexController.php
> 
> 
> $dir = array(
>       'default' => PROJECT_ROOT . '/application/default/controllers',
>       'admin'    => PROJECT_ROOT . '/application/admin/controllers'
> );
> 
> 
> $controller = Zend_Controller_Front::getInstance();
> $controller->setControllerDirectory($dir);
> $controller->setParam('noViewRenderer', true);
> $controller->throwExceptions(true);
> 
> 
> When I try to launch
> domain.com/        default module cicks in as is supposed to
> 
> but when I do
> domain.com/admin/index/index/
> 
> for example....it says
> File "IndexController.php" was not foundexception 'Zend_Exception'
> 
> and after some debugging I see it is looking for class
> Admin_IndexController.php
> 
> witch probably translates to admin/IndexController.php and not
> admin/controllers/IndexController.php

Read the documentation closely: except in the default module, modules
are namespaced with the module name, which is TitleCased. Thus,
admin/controllers/IndexController.php should contain the class
Admin_IndexController.

> 2. One more question:
> This models directory....I kind of miss how it comes together with the
> whole part. I mean...is there any way to include
> stuff automatically from there.... can I share automatically same models
> dir for two modules?
> Because right now to include something from there I am pretty much
> include manually stuff - which doesnt make much sense if it is suggested
> dir stays there.

We haven't spent much time on a generic model interface. We suggest
placing module specific models in a models subdirectory of your module
simply for grouping purposes -- consider, for instance, if you decided
to distribute a module, or wanted to restrict access in your repository
for certain developers to work only on certain modules -- all the code
is then in one place.

We don't have any methods yet for automatically including models within
a module. It's fairly easy to do it manually:

    require_once dirname(dirname(__FILE__)) . '/models/MyModel.php';

and I suspect we'll have either an action helper or a method in the
action controller post-1.0.0 to make this simpler.

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

Reply via email to