how do you trigger a MVC application.
im only used to use procedural coding. since everything are classes, how do i trigger the first method, where should this method be put, and what should the class holding this starter method be called?
thanks
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
This is too general of a question. The answer will be subjective, because it can be done in many different ways. Your best bet is to look at a simple, lightweight MVC framework, see how they did it, and use that as a guide. I recommend checking out LightVC.
Generally all requests are routed through an
index.phpfile. The request url is inspected to figure out what class file to include. For example, a request to/users/loginwould fire upUsers_Controller, and then it would execute thelogin()method on theUsers_Controllerclass. This is how most frameworks do it, but like I said, you should look at their source to get a better feel.