FuelPHP fundamentals ==================== What is MVC? ------------ MVC stands for Model-View-Controller. MVC is an approach to separating your code depending on what role it plays. Basically, a request is handled by the **controller**. It retrieves data using **models**. Then, it decides what **view** to use to display the data to your visitors. .. seealso:: `MVC in the FuelPHP’s documentation `__ .. seealso:: `MVC in Wikipedia `__ Where to create my new files? ----------------------------- Every classes follows the same precise naming convention: * lowercase, except the first letter of each level in uppercase ; * underscores are use to separate directories. For instance, the :file:`classes/controller/admin/login.php` file contains the class named ``Controller_Admin_Login``. PHP `classes `__ are placed in the :file:`classes` directory. `Controllers `__ classes are found in the :file:`classes/controller` directory. `Models `__ classes belongs in the :file:`classes/model` directory. How to write a view? -------------------- Views should be put in the :file:`views` directory. .. seealso:: `FuelPHP’s documentation on views `__ How to use the ORM? ------------------- An ORM does 2 things: * it maps your database table rows to PHP objects ; * it allows to establish relations between them. FuelPHP’s ORM uses the `Active Record `__ pattern. The following links from the FuelPHP’s documentation will help you: .. seealso:: `Creating models `__ .. seealso:: `Make DB queries based on these models `__ .. seealso:: `Define relatons and use them in the DB queries `__