There are two kinds of Preload, which are Site Preload and Module Preload. Site Preload is really simple.
- Create XXXX.class.php in /preload directory.
- Define XXXX class which is the sub-class of XCube_ActionFilter.
- Implement preFilter() and preBlockFilter() for your purpose. These member functions are virtual function of XCube_ActionFilter.
Member functions of XCube_ActionFilter are called in the common process, which implements initial process as well as common.php of XOOPS2. In XOOPS2, there were not any methods which site owners run their code in the initial process. To do it, they have to modify(hack) source code of XOOPS2 core.
Preload and ActionFilter are solutions for that problem. Through these features, site owners can run their code in initial process without hack.
You understand that Preload File is new publication unit. Site owners may share it with their friends. And, they can release it as well as modules and themes.
You can use Preload for multi purposes.
- Run initial code to customize.
- Add my functions to Delegate of other modules.
- Define Services or Delegate functions, and add it to Core for other modules.
- Exchange objects of the core.
- Load required libraries.