3.1.27. registerPhpFunction()

void registerPhpFunction ( mixed $name [, string $callback] )

Registers new PHP function in the parser. Depending on the number of parameters:

  1. The method takes an assotiative array as the first parameter, which contains pairs name => callback. "name" means the name, under which we want to see the function in the template. "callback" is a PHP function callback. This allows to register many functions at once.
  2. The method takes the name as the first parameter and the callback as the second one.

You can register every PHP function in the parser, using this method. No additional prefixes and parameters are required.

Note: this method is not available, if the Register method family was removed from the source with OPT Configurator.