Smart framework consists of smart modules. Each module is designed to be able to use it from any part of wordpress:

  • Wordpress plugin
  • Part of theme
  • Submodule in other modules

Because of this modular system you can easy customize SmartBuilder for your use. Add or remove modules without breaking core. Even use two or more the same modules without conflicts.

Module directory structure

index.php - Entry point. To add your module you need include this file
includes\ - modulename.class.php located here and other php files
assets\ - Directory for assets
assets\img\ - Directory for images
assets\js\ - Directory for JavaScript files
assets\css\ - Directory for Styles
templates\ - Directory with templates
modules\ - Submodules for this module

Modules directory

Any module can has nested submodules. These submodules can have their submodules. And so on. By default submodules located in "modules" dir of module.

Module class

Each module has module class. Module class should be inherit from "SmartModule" class. Class name is also module name.

Includes directory

All files from this directory will be included automatic. File with module class should be here.

Assets directory

Images, JavaScript files, CSS files and other public files located in this folder.

Templates directory

Smart framework follows the rule: No HTML/CSS/JS code in PHP classes. Static HTML/JS/CSS located in assets folder. Dynamic HTML/JS/CSS located in templates folder. What does it means "dynamic"? It means that HTML/JS/CSS code will be created from php template.

Modules initialization

Loading modules

Each module inherit SmartModule class. SmartModule class located in root module. We call this module Smart. Obviously, all our modules will be loaded after Smart module. If we try to load some module before module Smart has been loaded we should return and load this module later. We use action Smart_load_module for do this "lazy" loading.

If module Smart loaded we do next steps:

  1. Load all submodules from "modules" directory
  2. Include all files from include dir and register module class. This occurs only if module class has not been initialized before.

Registration module

All modules registering in specific order. We need register SmartComponentText module after SmartComponent module. SmartShortCodes should be registered after Smart module. This is accomplished due to the dependency system. How it work? index.php is file who responsible for this. Let`s see:

if (defined('ABSPATH')) {

    $module = "SmartComponentTest"; //Module Name the same as class name
    $dependency = "SmartComponent"; //Load after module SmartComponent will be loaded


Once module registered it call:



As you see smart modules is very flexible to use. For example you can:

  1. Have different plugins. This plugins have the same submodule. Only one of this modules will be registered, but all their submodules will be loaded.
  2. Have module in theme. And other module in plugins dir. They all will be loaded and registered the same way, no matter where module located.

Module dependency

Modules list

Access to registered module list:

global $smart;
$smart->modules();            // return all modules
$smart->modules('component'); // return all modules with type 'component'
$smart->modules('animation'); // return all modules with type 'animation'