1. Home
  2. Docs
  3. Simpods MVC
  4. Tutorials
  5. Models
  6. How To Create A Frontend Model

How To Create A Frontend Model

Location

Frontend models are located in the /mvc/models/ directory and must extend the MVC_Front_General class. The class name should be prefixed with MVC_Front_ and the filename should be the class name in lowercase with an extension of .class.php. For example, with a portfolio model, the class name could be MVC_Front_Portfolio with a filename of mvc-front-portfolio.class.php. If desired, models can be organised into sub-directories.

Required Methods

All frontend models must implement the following public methods;

  • actions: Registers all action hooks.

  • filters: Registers all filter hooks

Example File

In Simpods Basic theme, a minimal template is located in the /mvc/models/mvc-front-sample.class.php file. Note that this file will be loaded; to avoid errors remember to rename your model class before saving a new file.