0
点赞
收藏
分享

微信扫一扫

NVelocity and Collections (and Possibly Arrays)

蚁族的乐土 2022-07-28 阅读 49

I just spent 40 minutes banging my head against a pointy sharp wall. I’m using NVelocity as my view engine on a Monorail project and couldn’t figure out how to access an element of a collection.

$collection[0]          // Doesn't work
$collection(0) // Nuh-uh
$collection.[0] // Nope
$collection.get(0) // As per Velocity Docs. Nope
$collection.get_Item(0) // THIS WORKS!

Ok, so that’s incredibly not obvious. I couldn’t find any reference to it on the Castle Project Website​, the Velocity docs​ the Castle site refers you to, or pretty much anywhere.  I did find it in the google group though, but only after a lot lot lot of searching. So hopefully this will save someone out there a few minutes of their life.

Or maybe I should just switch to Brail.

 

​​http://www.jamesthigpen.com/blog/2008/06/04/nvelocity-and-collections-and-possibly-arrays/​​

举报

相关推荐

0 条评论