thank you very much! 2010-03-08
bluejoe2008 发件人: Claude Brisson 发送时间: 2010-03-08 15:52:37 收件人: Velocity Users List 抄送: 主题: Re: is it possible to use a relative file path in #parse and#include directives To enable relative resource loading for #include and #parse, you just have to put the following entry in your velocity.properties file: eventhandler.include.class = org.apache.velocity.app.event.implement.IncludeRelativePath Templates are then searched relatively to the current resource path. But relative resource loading is not the way to go if you want to refer to files outside the template root path: - in the context of a webapp, the WebappLoader won't let you go out of the webapp root - if you use the FileResourceLoader it won't let you exit the root path either, but you can specify several root paths, so it may be what you need: resource.loader = file file.resource.loader.class = org.apache.velocity.runtime.resource.loader.FileResourceLoader file.resource.loader.path = /var/www/myapplication file.resource.loader.path = /home/myhome/other_root_path and you may not need relative resource loading in this case. Claude On lun., 2010-03-08 at 13:32 +0800, bluejoe2008 wrote: > hi, i have a question about #parse and #include directives > when using #parse(<templatePath>) > the <templatePath> should be under TEMPLATE_ROOT > but i want to use a relative file path such as "./b.vm" or "../b.vm" > especially when current template a.vm is not under TEMPLATE_ROOT > > is it possible to use a relative file path in #parse and #include directives? > if not, who can tell me how to realize it? > > 2010-03-08 > > > > bluejoe2008 --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
