Processing requests in a MVC structure

They have: 3 posts

Joined: May 2005

I am new at building template based web sites. The template part I beleive I have grasped in my head but now I have to marry up the model and the view with the controller part of the MVC structure. I'm trying to decide whether to use modules in separate directories to process requests or use the template generator class to process the requests from the links in my menus and the rest of my application.

Some of my concerns is that I am creating classes like my template generator to become too specific, which will lead to mind-numbing confusing code. I have been at this point of confusion for a while so if anyone has any ideas on structuring the control portion of a web application I would be most grateful...

I am using PHP 5.0.4 with mysql v4.0.15

Thanks!
T

timjpriebe's picture

He has: 2,667 posts

Joined: Dec 2004

I always say as long as you decide on a structure up front and stay consistent in how you implement and arrange the structure, a variety of ways will work. Certain either the separate directories for modules or the template generator will work.

Now, personally, I would probably go with separate directories for modules just to, well, modularize everything. That way if something breaks, you know which module to take a look at, and don't have to wade through tons of code.

They have: 3 posts

Joined: May 2005

Thanks for your response! I thought I may be in the weeds using modules... Good to know it is probably ok to set it up that way. My big concern I guess is when the initial request for a page comes in - no matter how deep you are in the site - the request still hits the index.php page first, then the mainfile that directs it to the template generator and builds the 'page' and marrys it to the content which is retrieved in the module. Do you know of a way to decrease the number of files a request "passes" through like this? I don't know if one even exits but I get the feeling I'm missing something about this part of a PHP website....

Thanks!
T

Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.