Questions tagged [nvelocity]

NVelocity is a port of the Apache Jakarta Velocity project. It is a simple, easy to learn and extensible template engine.

NVelocity is a port of the Apache Jakarta Velocity project. It is a simple, easy to learn and extensible template engine.

99 questions
3
votes
3 answers

What WYSIWYG editor works with Velocity templates?

I've been working with (the excellent) CKeditor for a while, however when I started combining it with NVelocity I started to run into trouble. It turns out if I use a context keyword (say $GarbagePailKids which includes HTML of table rows) like…
Jason Sperske
  • 29,816
  • 8
  • 73
  • 124
3
votes
6 answers

What's the nvelocity/C# equivalent of "if x in array"?

Hacking on a Nvelocity C#/.NET view template (.cs file), I'm really missing the Python keyword "in" (as in, "foo in list"). What is the built-in for checking list/array membership? This is what my Python brain wants to do: #set ( $ignore =…
pfctdayelise
  • 5,115
  • 3
  • 32
  • 52
2
votes
2 answers

How can you get NVelocity to initialize correctly?

I can't get NVelocity to initialize. I'm not trying to do anything complicated, so it's just fine if it initializes at the defaults, but it won't even do that. This: VelocityEngine velocity = new VelocityEngine(); ExtendedProperties props = new…
Deane
  • 8,269
  • 12
  • 58
  • 108
2
votes
1 answer

NVelocity macro parameter not evaluating

I'm looking to create an inline function (method) inside my NVelocity template. The solution to this appears to be to use Velocimacros. So, I mocked up the following template to test: #macro( getOutput $one $two $three…
mattmc3
  • 17,595
  • 7
  • 83
  • 103
2
votes
1 answer

NVelocity syntax for calling methods with evaluated parameters

I have a fairly simple template that I need to make a method call from. However, NVelocity does not seem to evaluate method parameters that themselves are NVelocity variables. Take the following NVelocity template: #if (--- CONDITION SNIPPED ---) …
Ishan Chatterjee
  • 825
  • 8
  • 21
2
votes
1 answer

Use NVelocity with Sitecore FieldRenderer

I have a FieldRenderer control on my web page which is bound to a Sitecore item. fieldRenderer.Item = SomeSitecoreItem; fieldRenderer.FieldName = "SomeField"; Now SomeField within my SomeSitecoreItem has NVelocity tokens. How can I have…
Ben
  • 538
  • 1
  • 9
  • 24
2
votes
1 answer

What is the syntax for if false in nVelocity?

What is the syntax for an not true or false if statement in nVelocity (or Velocity)? And more importantly, where is this in the nVelocity docs? I've been Googling for quite a while to no avail. I've tried several different combinations such as: #if…
Ev.
  • 7,109
  • 14
  • 53
  • 87
2
votes
1 answer

NVelocity advance lopping syntax

Currently I am doing a project which involve Nvelocity template, however, I need use advance foreach, I could find the reference, just I could not figure out how does it works,reference link #foreach($l in $markPoint)hardcodetext($l)#end however, I…
Jian_H
  • 173
  • 1
  • 4
  • 18
2
votes
1 answer

NVelocity template error in c#

I am fairly new in using NVelocity. I am trying to edit some of the old templates for my company and i ma getting this error which i dont understand. OK so in template, if order has multiple shipments then show multiple shipment name and if only one…
patel.milanb
  • 5,822
  • 15
  • 56
  • 92
2
votes
2 answers

How to handle XSS on NVelocity

Castle Project is full of features, includes some awesome subprojects, and developing with it has been a pleasure. My team is almost ready to deliver a custom made EAM and we are polishing our system. We tried some basic XSS attacks and guess: They…
wtaniguchi
  • 1,324
  • 14
  • 22
2
votes
2 answers

NVelocity merge fails if last character in template is $

I've got a strange problem using the Castle NVelocity... If the template string ends with a $ character, it throws the following and exception: Lexical error: NVelocity.Runtime.Parser.TokenMgrError: Lexical error at line 1, column 94. …
HarveySaayman
  • 351
  • 3
  • 12
1
vote
1 answer

NVelocity: "Cannot read from a closed TextReader"

Just getting started on NVelocity (v1.1.1) and it seems to be working just fine. There's just one small thing that annoys me. I've set up VS2010 to break each time an exception is thrown even though it gets handled somewhere, and when running the…
bernhof
  • 6,219
  • 2
  • 45
  • 71
1
vote
1 answer

NVelocity where string value is null

I have a template, and I pass in an object. Some of its string properties are null. When this is the case, the template prints out $myObj.MyProp as soon as the property has an actual string value, the string value will be replaced in the template…
ozz
  • 5,098
  • 1
  • 50
  • 73
1
vote
1 answer

Castle 3.0 ILogger breaks the NVelocityTemplateEngine wrapper?

It appears that the the ILogger interface in 3.x is missing a method for .Info that the TemplateEngineNeeds. I'm getting the following error... Method not found: 'Void Castle.Core.Logging.ILogger.Info(System.String, System.Object[])'. I'm using…
Steven
  • 860
  • 6
  • 24
1
vote
0 answers

NVelocity syntax (#) breaks the syntax highlighting binded to vm extensions

As far as I know, there's no way to get good NVelocity syntax highlighting for Visual Studio 2010 that preserves html, css and javascript highlighting as well, so the way I do it is to go to Tools > Options > Text Editor > File Extension and add vm…
olemarius
  • 1,124
  • 4
  • 17
  • 27