Here we use callback function to iterate between two background colors of table cells. The beauty of this example is that all the logic to select the needed color is contained in the script, while the colors themselves are inside the template.
Note also that the callback is called only once per parse() call, that's because all of the calls are identical.
Error code | Error message | Reason | Solution |
---|---|---|---|
{code} | {message} | {reason} | {solution} |
You can plug in any kind of i18n solution as a callback for 'func_translate'. Note that all the messages are contained in the template and can be edited without touching scripts.
A common problem is to output the same variable, but encoded/processed in different ways. The shorthand {var:callback} for callback functions and default callbacks 'h', 'u' and 'j' were added specifically to address this.