Welcome, Guest. Register Now!
   
Mark Forums Read Mark Forums Read Mark Forums Read


Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 04-22-2008, 11:48 PM
Junior Member
 
Join Date: May 2007
Posts: 22
Default admin / public interface layout (modular, ...)

This is one thing I have not yet fully understood as what is the best practice to seperate two interfaces (public and admin) of the same web app. I have couple of ideas:
Have 2 modules - public and admin:
Code:
Application
   + Admin
      + controllers
         + IndexController, ArticlesController, ForumController, ...
      + views
      + models
   + Public
      ...
In this case I find that sharing models between 2 interfaces is combersome.

My other idea is to treat each type of the content page as a module (articles, forum, gallery) and have AdminController and PublicController files
Code:
Application
   + Articles
      + controllers
         + PublicController, AdminController
   + Forum
      ...
This approach allows to package modules and related files more closely together what I think is a plus. I am personally in favour of the second but would like to hear what other people think or what solutions have you used.

My 3rd idea is splitting both interfaces completely apart and use sort of common classes...
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 04-23-2008, 05:28 AM
Junior Member
 
Join Date: Apr 2008
Posts: 5
Default

You can set include_path with directory to the public models as default and create abstract controller for all admin controllers with additional path to admin models if needed.
PHP Code:
abstract class My_Controller_AdminModule extends Zend_Controller_Action 
{
public function 
init() {
      
set_include_path(    get_include_path() . PATH_SEPARATOR .
                            
realpath('../admin/models/'));

I use it once and it works pretty fine for a small project. You can also put into this controller all stuff used only by admin controllers in order to remove some code from bootstrap.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 04-23-2008, 02:38 PM
Junior Member
 
Join Date: May 2007
Posts: 22
Default

This doesn't solve my dilemma. Especially if my project is neither smalll nor exactly simple. It also introduces an extra level of indirection.

I am looking for a clean solution to seperate two interfaces and yet couple them together in a logical way. I don't personally like the idea of hiding bootstrap logic into derived controller base classes - it will confuse someone else working with my code.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 04-23-2008, 04:47 PM
Member
 
Join Date: Jan 2008
Location: chicago
Posts: 98
Default

What if you stored these classes instead where your Zend Library directory is and then included it in your include path?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 04-23-2008, 04:49 PM
Member
 
Join Date: Jan 2008
Location: chicago
Posts: 98
Default

Or if your two interfaces are going to be so closely intertwined, dont even make a second module, just make a second Zend_Layout file.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT. The time now is 11:04 AM.