From cf835164e555166072cdf2ba54b2056ddb8d71ff Mon Sep 17 00:00:00 2001 From: Patrick Date: Tue, 16 Sep 2014 21:12:54 +0200 Subject: [PATCH] added content to the controller part --- 6-controllers.md | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) diff --git a/6-controllers.md b/6-controllers.md index 8bcd605..a9b534d 100644 --- a/6-controllers.md +++ b/6-controllers.md @@ -4,4 +4,52 @@ When I talk about a controller in this tutorial then I am just referring to a class that has handler methods. I am not talking about [MVC (Model-View-Controller)](http://martinfowler.com/eaaCatalog/modelViewController.html) controllers. MVC can't be implemented properly in PHP anyway, at least not in the way it was originally conceived. So forget about MVC and instead let's worry about [separation of concerns](http://en.wikipedia.org/wiki/Separation_of_concerns). +Create a new folder inside the `src/` folder with the name `HelloWorld`. This will be where all your hello world related code will end up in. In there, create `HelloWorldController.php`. + +``` +$method($vars); + break; +``` + +So instead of just calling a handler method you are now instantiating the controller object and then calling the method on it. + +Now if you visit `http://localhost:8000/hello-world` everything should work. If not, go back and debug. And of course don't forget to commit your changes. + to be continued...