-
Notifications
You must be signed in to change notification settings - Fork 0
Controllers
John David Manning edited this page Dec 24, 2015
·
2 revisions
Controllers are the component in SECC MVC that direct how data should be manipulated. A controller is a class that is located in the app/controllers
directory. A route must call a controller and a method to execute.
The example controller provided is named HomeController
. It's contents are as follows....
namespace SECC\Controllers;
use SECC\App;
class HomeController
{
public function index()
{
App::service('View')->render('templates.frontend.pages.home');
}
}
The route home
calls HomeController
controller and the method index
in it's json file. From here you may execute whatever logic you wish. Here we are simply rendering a view.