1. Home
  2. Docs
  3. Simpods MVC
  4. Tutorials
  5. Controllers

Controllers

In an MVC structure, the controller provides the link between the model and the view. It is responsible for deciding what data should be passed through to the view. The controller is where you should do all of your data processing before loading the page.

You should also use the controller to register and enqueue scripts and styles, rather than linking to them in the header. This allows you to prioritise files and ensure that they are loaded in the correct order.

You can also pass data from the back end to the front end by localising PHP variables to Javascript variables. A guide can be found here.

Articles