Tigraine

Daniel Hoelbling-Inzko talks about programming

Mixing static strings with NVelocity variables

Posted by Daniel Hölbling on July 14, 2009

In an ongoing effort to get into NVelocity while programming the iC-Website I wanted to concatenate a filename with the current loop count variable:

<img src="/Content/images/dummy$velocityCount.png" alt="post-image" />

This isn’t working. You’ll end up with dummy$velocityCount.png. While I’d like it to result in dummy1.png.


I suspected it could be solved somehow by using our beloved angle bracket to tell NV to explicitly evaluate my text:

<img src="/Content/images/dummy{$velocityCount}.png" alt="post-image" />

This will result is dummy{1}.png, why is beyond me but NV will parse it. Still this doesn’t really work so I found the solution on how to explicitly invoke NV evaluation in the NV users guide:

<img src="/Content/images/dummy${velocityCount}.png" alt="post-image" />

This is nothing really new, it’s all laid out in the NV users-guide, still especially the second case made me scratch my head for a moment.

Filed under net, programmierung
comments powered by Disqus

My Photography business

Projects

dynamic css for .NET

Archives

more