-
Notifications
You must be signed in to change notification settings - Fork 1
Main concepts
That's the main object, the container of your application. Your Application.cfc will (or should) extend it.
Config object contain :
- your parameters for your application.
- Your environnements rules and parameters
- Your contexts rules
- your routes
A environment is a one or group of software environment with same configuration.
By example, you development configuration can be set as "debug environment" (in opposition of production).
Environment is detected on application startup process, so it's a almost a constant.
A context is a pure self-determined name by some (http) resquest rules.
So it will be redetected on every requests.
By example, we can decide to have different contexts based on domain names.
A route is an association of parameters to determine on an URI pattern, which function on which controller will respond to the request.
You set a route by calling the addRoute() function of Router object.
getRouter().addRoute(id='home', route='/home', controller='DefaultCtrl', action='home');
A controller is the 'C' part of MVC design pattern.
It will respond to a (http) request with a rendering view.
But before it return a response, it can do some action on your model through services.
Controllers do not make any direct action, it asks services (or DAO) to do it.
Your controllers must extends AbstractController from cfFramework.
Views are the "viewable" part of an application. It will render some output for user browser. Views will certainly not do any actions besides rendering.
A rendering can be called in controller like this
getRender().render('your_view.cfm', {'arg1' = 'value1'}, 'layout.cfm');
The file your_view.cfm will be called and rendered with parameter arg1, and putted on a general layout "layout.cfm".
A layout is a common view which almost never change from a page to another. Header and footer can typically be putted on layout.
Layout is called by optionnal argument layout on render() function.
That's the main rendering part of your application. Views are templates of your application.
Widgets are some sub-tiny-templates which can help you to organise and clean your views. Typically use for sidebar, navigation menu, ...
You can call it from view or layout by
widget('myWidget.cfm', {'arg2'= 'Value2'});
Services are used to manipulate your objects model (througt or with DAO).
It's likely your public functions to your application API.
Remenber that services (like controllers and DAO) are singleton.
Copyright (c) 2016, Jerome Lepage ([email protected])