Beepye
Beepye

Reputation: 328

Velocity foreach loop is not returning properties of object

I have a velocity template #foreach loop that's not returning the expected properties from the object I'm trying to get them from: competitorAttributes in the ppcThemeData object:

#set($ppcThemeData = {
        "competitorAttributes": [
            "Save up to 40%",
            "Set price of $116",
            "6 attractions from a choice of 9",
            "3 predetermined attractions",
            "Voucher by mail or print",
            "Visit attractions for up to 9 days",
            "No Hop-On Hop-Off bus tour"
        ]
    }
})

The loop cycles through each property creating a list item. This loop, however, is not returning anything inside of the <ul>. It is also not throwing any errors in the console and the page loads without any issues.

<ul>
#foreach($competitorAttribute in $pageTheme.competitorattributes)
    #set($index = $velocityCount - 1)
        <li><span>$competitorAttribute</span></li>
    #end
</ul>

Upvotes: 0

Views: 449

Answers (1)

Beepye
Beepye

Reputation: 328

$pageTheme.competitorattributes needs to be: $pageTheme.competitorAttributes - the A needs to be camel-case.

Upvotes: 0

Related Questions