Zolole In addition to guides like this one, we provide simple cloud infrastructure for developers. They must be defined before the default route. In our examples, we will be working on a droplet, running the latest version of Ubuntu. With Views — Controllers, after processing the information received with the request and data from models, pass this information by the view layer to return a final response along with its presentation i.
|Published (Last):||6 July 2018|
|PDF File Size:||6.97 Mb|
|ePub File Size:||12.5 Mb|
|Price:||Free* [*Free Regsitration Required]|
Today I will explain the basics of controllers and routes so you can finally be productive with Kohana. I will begin by explaining routes and how they could relate to the directory structure and naming conventions of your controllers. They do hold some meaning to them, and with that being said, you should be able to know where the location of the class is just by reading the name of its definition.
The admin section would be a separate area of the website obviously not available to normal users. In order to serve up this file in the web browser, we would have to specify a route in our bootstrap file. Below illustrates the different parts a route can have: The Route pattern is what the url will need to match in order to successfully find the page at that location.
The required part of the route is not enclosed inside parenthesis , whereas the optional part of the url will be inside of nested parenthesis. Each segment enclosed in carrots will then be available in a variable later on, inside your action. The defaults array specifies the parts of the route explicitly. Since my settings controller is in my admin folder, I need to specify the directory as I did above.
This is really about it. You can read about those here. I know I like the route system provided in Kohana, but once you fully understand them, they seem extra useful and you will definitely see the power they give you. If you have any questions leave them in the comments. Thanks, and happy coding! Dont forget to sign up for my new startup This Is Epic You might also like:.
Getting Started with Kohana 3, Part II – Bootstrap
Kohana PHP Framework
Getting Started with Kohana 3, Part I – Initial Setup