Reputation: 3302
I have the following freemarker code
<#assign carsPriceDescriptionSB = "Price guide" >
<#if vehicle.getPriceDescription == carsPriceDescriptionSB >
<div class="cgl304 data-source small">Some text
<br/><br/>
</div>
</#if>
What I want to do is check that the value of vehicle.getPriceDescription() is equal to Price guide and if the result is true display the block of code
Upvotes: 0
Views: 269
Reputation: 831
To access the get method you should drop the 'get' or explicitly specify the method name followed by brackets. Avoid using the second method unless necessary.
Normally omit the get prefix
<#assign carsPriceDescriptionSB = "Price guide" >
<#if vehicle.priceDescription == carsPriceDescriptionSB >
<div class="cgl304 data-source small">Some text
<br/><br/>
</div>
</#if>
Or if it is not a get method then specify the entire method name
<#assign carsPriceDescriptionSB = "Price guide" >
<#if vehicle.readPriceDescription() == carsPriceDescriptionSB >
<div class="cgl304 data-source small">Some text
<br/><br/>
</div>
</#if>
Upvotes: 1