Can $DateTime.Now.Year be used with NVelocity to display the current year?
문제
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?
해결책
No, as far as I know NVelocity templates only work with objects set in the VelocityContext.
다른 팁
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);
제휴하지 않습니다 StackOverflow