data

Note: This is a deprecated function, largely superseded by [%if%] and simply the [@tag@] tags.

Data

Neto's legacy tag for writing conditionals and calculations.

Example

[%set [@test@] %]2[%/set%]

[%data id:'test'%]
    [%param case_1%]1[%/param%]
    [%param case_1_value%] one[%/param%]

    [%param case_2%]2[%/param%]
    [%param case_2_value%] two[%/param%]

    [%param case_3%]3[%/param%]
    [%param case_3_value%] three[%/param%]

    [%param case_default_value%] default fallback[%/param%]
[%/data%]

Usage

Dynamically Referencing Tags

Data encapsulated within the [%data%] tag can be referenced dynamically.

[%forloop from:'1' to:'40' %]
    [%param *body%]
        [%data id:'misc[@count@]'%]
            [%param case_1%]misc33[%/param%]
            [%param case_1_value%] Display content[%/param%]
        [%/data%]
    [%/param%]
[%/forloop%]

Calc Function

[%data%] can also be used as a calc function.

[%DATA id:'count' calc:'%' cvalue:'2' if:'=' value:'0'%]
    [%PARAM *if_true%]...[%END PARAM%]
    [%PARAM *if_false%]...[%END PARAM%]
[%END DATA%]

Parameters

Name Options Description
id HTML & b@se tags Sets the ID for the data so it can be referenced/targeted elsewhere.
if HTML & b@se tags The initial condition of the tag
if_true HTML & b@se tags Return value for code that complies with the initial condition of the tag
if_false HTML & b@se tags Return value for code that does not comply with the initial condition of the tag
calc HTML & b@se tags Calc function for performing arithmetic within the conditional. Accepts calc parameters
fvalue HTML & b@se tags Used to specify return order for calc function results. Precedes the value of the variable specified by ID
cvalue HTML & b@se tags Used to specify return order for calc function results. Succeeds the value of the variable specified by ID
case_* HTML & b@se tags Designation for cases to be included in the tag, can be 1 - 999
case_*_value HTML & b@se tags Values of designated cases, can be 1 - 999

Was this article useful?

Be notified when this page is updated. Optional.