Web Analytics Made Easy -
StatCounter using MVC in php - CodingForum

Announcement

Collapse
No announcement yet.

using MVC in php

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • using MVC in php

    i know the idea of MVC. please check whether it is right or wong
    M- for data that is all code related with database(insertion,deletion,update,retrieve) should remain in MODEL.php file or MODEL class

    V- view that is all user interface related function remains in one VIEW class or VIEW.php file

    C-control that is all business related functions like accounting(if related with business)should remain in CONTROL.php or CONTROL class

    am i correct so far if not please feel free to give correction.

    now my problem knowing this all i am confused coding with MVC framework as i think whether my idea is correct or not.

    please provide me a complete example of MVC (code of MVC). so it would be helpful for me.
    http://www.atneshop.com/
    http://channelishop.com/

  • #2
    I'm no expert on MVC but it looks like you have the three concepts figured out pretty well, but just don't lock yourself into thinking you can only have three classes or three PHP files. The number of classes and files you'll use depends entirely on your application and can number in the dozens.

    I googled model view controller explanation and severel good articles popped up. This one was pretty good (though didn't mention PHP once):

    http://www.perlmonks.org/?node_id=402070

    And this one is on Sun's website so it focused on Java's interpretation of the MVC pattern, but was still good detailed info:

    http://java.sun.com/blueprints/patterns/MVC.html

    And of course, if you really really really want to follow the MVC pattern, you should seriously consider using an MVC-based framework.

    Comment

    Working...
    X