Skip to content
dbald edited this page Sep 15, 2010 · 6 revisions

Naming Conventions

Home > Naming Conventions

In order for the framework to work as expected all the time we needed to have a set of naming conventions so that we can achieve this.

Loading Pages

The URI can have dashes or underscores in it based on what you set up in the configuration but by default the framework uses underscores. The dashes and underscores in the URI translate to either dot’s or capital letters in filenames, classnames, or method names. For the examples bellow we will be using dashes.

This example shows how the URI translates to the controller file and controller class name.

/* URI */
http://localhost/products-services

/* Controller File */
controllers/procucts.services.php

/* Controller Class Name */
ProductsServices_Controller

This example shows how the URI translates to the controller file, controller class name, view file, and view method.

/* URI */
http://localhost/products-services/light-bulbs

/* Controller File */
controllers/products.services.php

/* Controller Class Name */
ProductsServices_Controller

/* View Method Name */
lightBulbs

/* View File */
views/products.services/light.bulbs.php

This example shows how the URI translates to the branch folder, branch name, controller file, controller class name, view file, and view method.

/* URI */
http://localhost/content-controller/products-services/light-bulbs

/* Branch Folder */
branches/content.controller

/* Branch Name */
ContentController

/* Controller File */
branches/content.controller/controllers/products.services.php

/* Controller Class Name */
ProductsServices_ContentController_Controller

/* View Method Name */
lightBulbs

/* View File */
branches/content.controller/views/products.services/light.bulbs.php

Loading Classes

Classes also have a specific naming convention in the framework so that the framework knows which file to load and from where. The template used for loading in a class in the framework is:

/*
[class name]: This is the name that you are giving the class and this is also the name of the file, e.g. [class name].php

[branch name]: This is the name of the branch to load the class from. This part of the class name is optional as you may
    not want to load a class from a branch but rather load it from the main framework folders.

[type]: This is a required part of the name of the class and classifies a class as a type so that the framework knows which
    folders to load the class from. The options are: Model, Helper, Plugin, and Controller.
*/
$object = new [class name]_[branch name]_[type]();

Clone this wiki locally