1. Home
  2. Docs
  3. Simpods MVC
  4. Tutorials
  5. Models
  6. Global Model For Both Admin And Frontend

Global Model For Both Admin And Frontend

The logic in Simpods is that the frontend only loads frontend stuff and the backend only loads backend stuff, but sometimes we need functions for both frontend and backend at the same time.

custom-ajax.class.php and custom-global.class.php

There are two classes you can create and modify and they will be automatically loaded by Simpods for the frontend and backend. They are custom-global.class.php and custom-ajax.class.php, located at the root of the mvc folder. If it is not there, you can simply create them. They don’t have to extend any classes. custom-global.class.php will be auto-instantiated if the class name is Custom_Global, and you can access its instance by global $custom_global. custom-ajax.class.php will be auto-instantiated if the class name is Custom_Ajax.