The HTML markup for this example:

{% filter escape %}
{{ "{% partial \"calcresult\" %}" }}
{% endfilter %}

The calcresult partial:

{% filter escape %}
{{ "{% if result %}" }}
    The result is {{ "{{ result }}" }}.
{{ "{% else %}" }}
    Click the Calculate button to find the answer.
{{ "{% endif %}" }}{% endfilter %}

The onTest PHP code:

function onTest()
{
    $value1 = post('value1');
    $value2 = post('value2');
    $operation = post('operation');

    switch ($operation) {
        case '+' : 
            $this['result'] = $value1 + $value2;
            break;
        case '-' : 
            $this['result'] = $value1 - $value2;
            break;
        case '*' : 
            $this['result'] = $value1 * $value2;
            break;
        default : 
            $this['result'] = $value1 / $value2;
            break;
    }
}

Continue to Plugin components