Something to be aware of with the conditional tag.
Whereas in vb3.x, fetch_template was typically eval()'d in the scope of the function that created the template output, in vb4, the template is eval()'d inside another function. Since the conditional test refers to standard php variables rather than the vb registered template variables, this can create a situation where the variable you are testing is not in scope, so the test will always fail.
For example:
PHP Code:
function myfunc() {
$myvar = 1;
$templater = vB_Template::create('mytemplate');
$templater->register(myvar', $myvar);
print_output($templater->render());
}
where mytemplate contains:
PHP Code:
val: {vb:raw myvar}
<vb:if condition="$myvar==1"> say again {vb:raw myvar}</vb:if>
will only output "val: 1"
You can get round this by explicitly referring to the registered variable in the vb:if condition as follows:
PHP Code:
val: {vb:raw myvar}<br />
<vb:if condition="$this->registered['myvar']==1"> say again {vb:raw myvar}</vb:if>
which will output "val: 1 say again 1", which is what the equivalent vb3.x template would have achieved.