3.1.22. registerFilter()

bool registerFilter ( int $type, string $callback )

Registers a new content filter. The $type parameter defines its type (OPT_PREFILTER, OPT_POSTFILTER, OPT_OUTPUTFILTER) and the second parameter is a filter function callback without the prefixes optPrefilter, optPostfilter or optOutputfilter. So, if you have a function optPrefilterMyFilter, you register it in this way:

$tpl -> registerFilter(OPT_PREFILTER, 'MyFilter');

More about content filters - see New filters.

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