Hi Guys,

I am a total newb when it comes to ZF, and I want to start doing all our new 
development with the framework. Anyway, I was working through the Quick Start 
and also the Zend Framework In Action book, and it became clear to me that ZF 
allows for a nice separation between application 'modules' on the site. So for 
instance, we can write an app for http://www.mysite.com and the controllers etc 
all live under the application/ directory. What I am trying to work out, is the 
correct way to configure the front controller using the new Zend_Application 
and Zend_Bootstrap class so that I can have sub-sites within the site. Say, 
something like this:

http://www.mysite.com
    mysite/application/...

http://www.mysite.com/admin
  mysite/modules/admin/...

http://www.mysite.com/blogs
  mysite/modules/blogs/...

The point of having the sub-sites is to keep a clear separation of code between 
the different sites, so for instance we can have an admin back end that is kept 
separate from the public front end, to make the code easier to maintain (shared 
classes can live in the common library directory).

I know it is possible to do it, but it is not clear how we are supposed to set 
things up with the front controller do to this. From the docs, I can see I need 
to find the instance of the front controller and call:

$front->addControllerDirectory('../modules/admin', 'admin');

But I am not sure where I should be doing that? Should I be adding an 
_initFrontController() function to the bootstrap class? If so I do that though, 
I need to write an entire init sequence and I am not sure how it should be 
written, because adding this function overrides the default init sequence for 
the front controller.

But perhaps there is a way to set this up in the application.ini file, to tell 
the front controller to set up the different modules that I want?

Also, if I did set this up, I would also need to register another directory 
with the module auto loader for other classes that would live in the sub-site 
directories. The default is to call this:

    $autoloader = new Zend_Application_Module_Autoloader(array(      
'namespace' => 'Default',      'basePath'  => dirname(__FILE__),    ));    
return $autoloader;
But I am not sure how I would restructure this call to add two name spaces? Ie: 
adding another namespace for say 'Admin' so it loads classes under the 
mysite/modules/admin/... Directory.

Regards,

Kendall Bennett, CEO
A Main Hobbies
424 Otterson Drive, Suite 160
Chico, CA 95928
1-800-705-2215 (Toll-Free)
1-530-894-0797 (Int'l & Local)
1-530-894-9049 (Fax)
http://www.amainhobbies.com

Reply via email to