Jump to content

Controller and Loader classes


Cardale

Recommended Posts

I've been trying to figure out a good way to have a controller and loader class that is still within the MVC design pattern.  Basicly this is what I think it should do from looking over other frameworks and projects.

 

Controller will handle the requests from get and post methods...is there anything else?

 

loader class will auto load these classes from the controller....

 

Should I be looking to expand these any do I need to look into something else maybe more abstraction?  I'm just learning MVC and new PHP5 functionality.

Link to comment
Share on other sites

Probably a good place to start with is __autoload() . Specify this function and it'll help you load up your classes without the need for includes or namespaces. Probably not quite what you meant about a loader however...

 

In regards to initialising your application controller and loader. A lot of higher class languages use XML for a configuration file. So ideally I would expect the initialisation process to be.

 

1) Initialise front controller

2) Initialise application helper (contains methods for initialising the XML application file and other registry options)

3) Get application controller from the helper

4) Iterate through the application controller's commands

5) Call execute() (interface based) on each command that is returned

6) The internals of the command decide whether to forward to another command.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.