Thanks Shinobi,

I pulled VM_global_library.vm into my web apps WEB-INF folder, added another 
.vm file to contain my own velocimacros, pulled in velocity.properties and 
changed it as you suggested.

One step that caught me out was needing to add the following element into the 
velocity servlet definition in web.xml

                <init-param>
                        <param-name>org.apache.velocity.properties</param-name> 
                        <param-value>/WEB-INF/velocity.properties</param-value> 
                </init-param>

Thanks for you help again!

Robin

-----Original Message-----
From: Shinobu Kawai [mailto:[EMAIL PROTECTED]
Sent: 23 March 2005 18:24
To: Velocity Users List
Subject: Re: velocity.properties


Hi Robin,

> I'd like to make a common file to put velocity macros into and I understand I 
> need to create a velocity.properties file, I'm just not sure where to place 
> it within my web application folder tree for it to be picked up.
> 
> I also don't want to override the default values held in VM_global_library.vm
> 
> An extract from the Velocity manual indicates the following for defining 
> velocimacros libraries but stops short of telling me where to put it.....
> 
> velocimacro.library = VM_global_library.vm
> 
> "Multi-valued key. Will accept CSV for value. Filename(s) of Velocimacro 
> library to be loaded when the Velocity Runtime engine starts. These 
> Velocimacros are accessable to all templates. The file is assumed to be 
> relative to the root of the file loader resource path."

It's this part:  "The file is assumed to be relative to the root of
the file loader resource path."
(Actually, it should say "resource loader path" instead of "file
loader resource path", because the file loader is only the default.)

So you can add your library, say "robin/greatstuff.vm" like this:

velocimacro.library = VM_global_library.vm,robin/greatstuff.vm

And your directory structure will be like this:  (on default settings)

/path/to/template/root
  /VM_global_library.vm
  /robin
    /greatstuff.vm

Best regards,
-- Shinobu

--
Shinobu Kawai <[EMAIL PROTECTED]>

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


====================================================================
This e-mail and any attachments may be confidential and/or legally
privileged. If you have received this e-mail and you are not a named
addressee, please inform Landmark Information Group on 01491 413030
and then delete the e-mail from your system. If you are not a named
addressee you must not use, disclose, distribute, copy, print or rely 
on this e-mail. This email and any attachments have been scanned for
viruses and to the best of our knowledge are clean. To ensure 
regulatory compliance and for the protection of our clients and 
business, we may monitor and read e-mails sent to and from our 
servers.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to