-
Notifications
You must be signed in to change notification settings - Fork 0
MVC System
Justin Campo edited this page Oct 24, 2015
·
1 revision
##Overview The MVC System is how XESM stores all code where we handle all interactions with a user. It consists of three parts
M = Model = The logic
V = View = The information that is visible to the user
C = Controller = Takes the user information and passes it to the model
##Usage XESM automatically routes user request into the MVC System
User request : www.example.com/account/edit/
Loads:
./site/model/account.php
./site/view/account/edit.php
./site/controller/account/edit.php
##Model
- Keep methods as short as possible
Most models will extend ./site/model/xesm.php. This provides some default behavior and methods.
$this->item = \system\item\* = represents the a physical object (ie. a bottle of wine, a user)
$this->query = \system\query\* = all database interactions go through this class
init() = a method that allows you to create the model (with assigning data to item option)
assign() = allows you to assign data to an item easily
query($query_method, $data) = allow you to dynamically interact with the query object.
load() = Loads in data from database automatically
##View
- No inline CSS
- Table usage only in limited situations
- No javascript inline
##Controller
- Keep as slim/short as possible
##Code Explanation To learn more about how the system runs read about the Page Class