Open Power Template supports a plugin system. You may download the plugins from the Internet or just keep your add-ons in separate files and the library automatically loads them during the setup. However, remember that these files have to be included by PHP, which is a bit slower, than storing everything in one, big file (especially if you have many plugins). If your priority is the performance, consider the second solution and linking the new items with registerXXX() methods.
In order to enable plugins, set the plugins configuration
directive to the current plugin directory. It must be both readable and writeable
for PHP, because OPT needs to save there two files containing information about
the directory content, not to scan it every time. Except those two ones, all other
files must be named in this way: type.name.php
, where "type" is
the type of item we want to add. The following types are available:
component.sampleComponent.php
.instruction.optNewInstruction.php
- will register
"optNewInstruction" instruction processor.function.Power.php
will register a function "Power", which
source code is located in "optPower" PHP function.postfilter.Optimize.php
will register the "Optimize" postfilter, which
code is stored in "optPostfilterOptimize" PHP function.Remember that after installing new plugins you have to remove the files
plugins.php
and compile.php
manually
from the plugin directory.
By default, the plugins are loaded automatically, when OPT needs them. However, you can call the loadPlugins() manually, which may be especially useful, when working with components on the script-side.