[opencms-dev] Opencms & Velocity...

Andras Balogh abalogh at gmail.com
Fri Feb 24 16:28:52 CET 2006


Hello Ashok,

    I think  You are in the wrong direction. You see Velocity will look 
for files on the real file system
(i.e. harddisk) but opencms keeps the files in the VFS (i.e. the database).
So Velocity will not work in the normal way.
You will need to read the velocity template (vm) with the opencms api as 
file and use the:
Velocity.evaluate method:
http://jakarta.apache.org/velocity/docs/api/org/apache/velocity/app/Velocity.html#evaluate(org.apache.velocity.context.Context,%20java.io.Writer,%20java.lang.String,%20java.lang.String)

Best wishes,
Andras.

Ashok Hariharan wrote:

>Hi:
>
>I am trying to use Jakarta Velocity within Opencms.  Everything seems
>to work, but I cant to seem to get #include() or #parse() from within
>a velocity script to work.....
>
>I have tried prefixing "opencms://<path>" and without the prefix...but
>Velocity still cannot seem to include files from within the VFS.
>
>Error message as below...
>
><error message>
>Unable to find resource 'opencms://sites/default/test_include.vm'
>org.apache.velocity.exception.ResourceNotFoundException: Unable to
>find resource 'opencms://sites/default/include.vm' at
>.........
></error message>
>
>The velocity documentation talks about setting a TEMPLATE_ROOT...but
>am not sure if that is the problem.  Has someone experienced the same
>problem?
>
>thanks
>
>Ashok
>
>--
>++++ Ashok Hariharan ++++
>
>_______________________________________________
>This mail is sent to you from the opencms-dev mailing list
>To change your list options, or to unsubscribe from the list, please visit
>http://lists.opencms.org/mailman/listinfo/opencms-dev
>
>  
>




More information about the opencms-dev mailing list