KUIML
Blue Cat's User Interface Programming Language
TEMPLATE

Description

With this element, it is possible to define custom structures and reuse them later in the skin code. The result is similar to the DEFINE capability but it's much more powerful since it is able to reinstanciante complex structures instead of just a single element with predefined values.

It can also be extended using the TEMPLATE_INNER_CONTENT element.

Attributes

Name Value Type Default Value Description Comment V. Exp.

id

element id

empty

id of the template.

This is the name you will use everywhere in the skin and it will be replaced by the content of the template.

1.3

No

default values attributes

string

empty

default values for the variables contained in the template definition.

You can add as many attributes as you wish.

1.3

No

Syntax

First, declare a template as shown here:

<TEMPLATE id="TPL_MY_TEMPLATE" attr1="x" attr2="y" ... >
    <!--template structure with as many elements as you whish, with implicitly declared local variables-->
    <ELEMENTA attribute_a="$attr1$">
        <ELEMENTB attribute_c="$wxyz$"/>
    </ELEMENTA>
</TEMPLATE>

The attributes values declared in the template definition ("attr1" and "attr2" in the example above) are default values used when these attributes are not defined in the template instantiation.

Once this template has been declared, writing the following.

<TPL_MY_TEMPLATE wxyz="hello"/>

is equivalent to writing:

<ELEMENTA attribute_a="x">
    <ELEMENTB attribute_c="hello"/>
</ELEMENTA>