質問

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 )
ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top