We've started using the NVelocity template formatting engine. We were absolutely stymied for an hour, trying to figure out how to get it working with an absolute path to the template file, instead of the relative path shown in the documentation.
The trick is to set file.resource.loader.path. Here's how to load C:\foo\bar\somefile.vm:
file.resource.loader.path
C:\foo\bar\somefile.vm
ExtendedProperties props = new ExtendedProperties(); props.AddProperty("file.resource.loader.path", new ArrayList(new string[]{".", "C:\\"})); velocity.Init(props); template = velocity.GetTemplate("foo\\bar\\somefile.vm");
Page rendered at Monday, March 15, 2010 1:49:21 PM (Pacific Daylight Time, UTC-07:00)
Disclaimer The opinions expressed herein are my own personal opinions and do not represent my employer's view in anyway.
E-mail