A function is something that modifies the input data and generates the result. The input data are called parameters and they are simply some values we want to process. In OPT, functions have similar syntax to other programming languages and mathematics:
{function(parameters)}
parameters is a list of values or expressions separated by commas. If the function takes no parameters, we still keep the brackets. OPT has a number of different built-in functions and the programmers may create their own, too.
The example below shows the idea hidden behind the functions. Let's say the script sets the block called $introduction with a text "Welcome to our site", but in this layout, it has to be written with capitalized letters.
Now the value of $introduction block is passed to the function, which capitalizes all the small letters and returns the modified text to the template.
Some functions appearing in OPT may be easily replaced by CSS stylesheets and in the HTML template design there is no need to use them. However, the template engine is intended to work not only with the HTML data, but can process any of the text content, where such features may be the only way, for example to capitalize the letters.
Below, we provided a complete reference of functions available in OPT. In the description, we use the following data types:
Note: the square brackets in the synopsis mark optional parameters that do not have to be set, if not necessary.