You can define a macro:
#macro( formatboolean $booleanvalue )
#if ( $booleanvalue ) yes #else no #end
#end
and use it in your template:
#formatboolean ( $myboolean )
题
I'm new to Velocity, so I have a template with lot of boolean value. And what I want is to define just once a condition who replace every "true" by "yes" and every "false" by "no". Cause I don't want to write the condition for each of my variable.
There is a way to do that ? in the begining of my template for example.
解决方案
You can define a macro:
#macro( formatboolean $booleanvalue )
#if ( $booleanvalue ) yes #else no #end
#end
and use it in your template:
#formatboolean ( $myboolean )