Model, View, Controller (MVC) in Exponent
Overview
MVC is a modern programming paradigm which divides the various aspects of an application into three areas:
- Model is the data
- View displays the model data
- Controller performs the interaction with the data to calculate and present the view
Model/View/Controller Guide
-
Models
-
The basic data structure of a module which includes the database table Definition and the code to manage the data Model. The models are stored in the module's 'models' subfolder and the definitions are stored in the module's 'definitions' sub folder. Many modules contain multiple Definitions and Models.
... -
Views
-
Views are smarty templates (.tpl files) which are used to display data from the Model as manipulated by the Controller. The views are stored in the module's 'views' subfolder.
... -
Controllers
-
The workhorse of every module. It provides the Actions which manipulate the Model data and present it to the View for display. Controllers are stored in the module's 'controllers' subfolder.
... -
Assets
-
Other module support files are stored in the module's 'assets' subfolder which contains subfolders for 'css', 'images', and 'js' as needed.
...