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
https://forums.phpfreaks.com/topic/95188-controller-and-loader-classes/
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.

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.