Considering the following piece of code in a velocity template:
#set($brandName = $player.brand.name)
#set($brandNameExample = "NameExample")
#if($brandName == $brandNameExample)
11111
#else
22222
#end
I always get 22222
. Of course, player.brand.name = "NameExample"
.
Can anybody explain me why and how to get it work please?
I would recommend to test this
#set($brandName = "NameExample")
#set($brandNameExample = "NameExample")
#if($brandName == $brandNameExample)
11111
#else
22222
#end
if it works then I would try to output $player, $player.brand, $player.brand.name you need to make sure that $player.brand.name - keeps correct value. - case sensivity? - sure that spell '$player.brand.name' correctly?
I think you simply has problem in object $player
Well I found the solution : I called twice to velocity : the first time without the player object and second one with it. So at the first call all directives concerning player could not be evaluated and returned null. Thank you all for your help
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With