« Return to Thread: having trouble with setting simple module structure.

Re: having trouble with setting simple module structure.

by Maurice Fonk :: Rate this Message:

Reply to Author | View in Thread

On question 2: You can create a "global" model directory, or maybe put
global models into your "default" module's model directory. The only
important thing is that it is in your include path. But, even better, I
can point you toward a solution that popped up on this list yesterday:

http://www.nabble.com/Model-Loading-helper-tf3942096s16154.html#a11181598

hope that helps,
MF

Julian Davchev wrote:

> damn, I dig in deeper in mail archive.
> Turns out controller class should be named <module_name>_ControllerName
> I my case Admin_IndexController. Filename remains IndexController.php
> So question 1 is cleared.
>
> Someone could elaborate on question 2 would be great.
>
>
>
> Regards,
>
>
>
> Julian Davchev wrote:
>  
>> Hi,
>>
>>
>>
>> I must say I read the whole manual regarding controllers and most stuff
>> seems pretty straight forward but for some reason I couldn't do the
>> following.
>>
>> From what I see for my needs will be good to have one module for client
>> view and one admin  module for admin stuff.
>>
>> 1)
>> I tried using this
>> http://framework.zend.com/manual/en/zend.controller.modular.html
>> point 7.11.2
>>
>> 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
>>
>> Can someone lead me to what I do wrong?
>>
>>
>> 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.
>>
>> Thanks for time spent
>>
>> Regards
>>
>>
>>  
>>    
>
>
>
>  


--
Maurice Fonk

info@...
http://naneau.nl/

Scio me nihil scire

 « Return to Thread: having trouble with setting simple module structure.