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.

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 ajax.class.php and custom_global.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.

$customGlobalModels_arr

If you have more global classes to add, you can put them into this associated array $customGlobalModels_arr in functions.php, placing it before include_once 'mvc/load-simpods-mvc.php';, in the format: array( 'class_name' => '/mvc/your.class.php', ... );