cstone
9 years agoAce
Can a variable be used as a Macro parameter?
For example:
<#macro repeat count>
<#list 1..count as x>
<#nested>
</#list>
</#macro>
<#assign boardCount= rest("categories/id/sales/boards/count").value/>
<@repeat count={boardCount} >
<li class="detail-tile-shim"></li>
</@repeat>What is the correct way to achieve this?
Hi cstone,
simply remove the curly braces from the variable name you want to use in your macro:
<#assign count = boardCount % 3 />
<@repeat count=count >
<li class="detail-tile-shim"></li>
</@repeat>Cheers,
Christian