The MVC fun continues…

Well.. we finally decided that we should give the MVC framework process a chance, to see if we could truly benifit from it.

I’m going to be using a simple ish MVC framework and Smarty for the templating system, this seems to be working both logically and easy for us, or fairly easy anyway.

The way im going to do this is have a main page which will control the configuration etc, and then a series of templates for each section (ill come back to this) and then modules for each section too.

What i mean by section is this.. Basically the way I see how our company runs the existing database is based on a few sections(Customers, Orders, Searching, Report).. there is more, but this is just an example, so i’ve decided to have these as our main controlling elements.

So our intranet should work on this basis: http://address/index.php?section=Customer meaning our program knows we only want to be working with whatever is involved with a Customer, the same goes for Orders, Reports and so on, keeping the whole process a lot simpler (or so i think anyway)

With this in mind, ive now got a CustomerModelController which will take aditional parameters defining which action should be performed now we’re only concerned with the customer, for instance Search for Customers.

Our intranet again shows how easy and logical this makes things:

http://address/index.php?section=Customer&action=search_for_users or add_user etc, you get the idea anyway.

These methods allow me to have custom templates for each section, and still keep my code nice and tidy, so i’ve not got 100’s of smaller functions within one big controller.

I’ve tried not to go into too much detail here, so not to confuse people/myself anymore, but if anyone wants further explanations just let me know, and ill go into more detail.

Just want to say thanks to the people who have commented on the MVC ideas so far, definately made an interesting read, cheers!

  • Thought it might be worth mentioning another PHP MVC framework which is worth a look: Symfony (http://www.symfony-project.com/). This is a pretty thorough attempt at MVC + AJAX + database abstraction layer. It works well, though I found the configuration a bit tricky.

    You could also keep an eye on the Zend Framework (http://framework.zend.com/), which is kind of like Symfony but more “PHP-ish” and lower level (closer to PHP and less abstracted). As development is supported directly by Zend, there’s a good chance development will be rapid and solid.

    I had a look at Cake a while back, and it’s definitely the most Rails-like of these frameworks. I must have another look soon…

  • TESTING