The HOOK statement can be used to run a module hook from a template. By using hooks in the templates, you have an easy way for modules to add data to a page, without having to change the templates too much. Because these hooks need an activated module that acts upon them, creating HOOK statements is certainly for advanced users only.
{HOOK <HOOK NAME> [<ARG1> <ARG2> .. <ARGn>]}
Both the <HOOK NAME>
and the
arguments that are used in the HOOK statement can be any
of the data types that are supported by the template
language (see Section 1.4.3, “Data types”).
Depending on the number or arguments that are used in the
HOOK statement, different type of calls are made to the
hook function for the given
<HOOK NAME>
.
hook_function()
hook_function($ARG1)
hook_function(array($ARG1,$ARG2,..$ARGn))
Example 1.20. HOOK statement usage
{HOOK "template_hook"} {LOOP MESSAGES} {HOOK "show_message" MESSAGES} {/LOOP MESSAGES} {VAR HOOKNAME "my_magic_hook"} {HOOK HOOKNAME "my argument"}