0

Sorry that this is kind of a lazy questions...

I'm curious if $DateTime.Now.Year can be used with NVelocity templates to show the current year? Or do I need to set a variable?

BueKoW
  • 926
  • 5
  • 18
  • 33

2 Answers2

1

No, as far as I know NVelocity templates only work with objects set in the VelocityContext.

Mauricio Scheffer
  • 98,863
  • 23
  • 192
  • 275
0

But there is no problem with adding your custom objects to the context and then use them in the template.

_context = new VelocityContext();
_context.Put("your_key", your_object);
Dawid Rutkowski
  • 2,658
  • 1
  • 29
  • 36