<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="CONTENT-TYPE" CONTENT="text/html; charset=windows-1252">
<TITLE></TITLE>
<META NAME="GENERATOR" CONTENT="OpenOffice.org 641 (Win32)">
<META NAME="CREATED" CONTENT="20020708;16081500">
<META NAME="CHANGED" CONTENT="20020708;23580998">
<STYLE>
<!--
@page { size: 21.59cm 27.94cm; margin-left: 3.18cm; margin-right: 3.18cm; margin-top: 2.54cm; margin-bottom: 2.54cm }
P { margin-bottom: 0.21cm }
TD P { margin-bottom: 0.21cm }
-->
</STYLE>
</HEAD>
<BODY LANG="en-US">
<P STYLE="margin-bottom: 0cm"><B>OpenCMS Velocity integration.</B></P>
<P STYLE="margin-bottom: 0cm"><BR>
</P>
<P STYLE="margin-bottom: 0cm">Reference Library needed
</P>
<OL>
<LI><P STYLE="margin-bottom: 0cm">commons-collections.jar</P>
<LI><P STYLE="margin-bottom: 0cm"><A HREF="http://logkit-1.0.1.jar/">logkit-1.0.1.jar</A></P>
<LI><P STYLE="margin-bottom: 0cm"><A HREF="http://velocity-1.2.jar/">velocity-1.2.jar</A></P>
</OL>
<P STYLE="margin-bottom: 0cm"><BR>
</P>
<P>Extend opencms.properties file, add following contents:
</P>
<P><BR><BR>
</P>
<TABLE WIDTH=1262 BORDER=0 CELLPADDING=0 CELLSPACING=0>
<COL WIDTH=1262>
<TR>
<TD WIDTH=1262 VALIGN=TOP>
<P>#----------------------------------------------------------------------------</P>
<P># Velocity T E M P L A T E L O A D E R S for OpenCMS</P>
<P>#----------------------------------------------------------------------------</P>
<P>#</P>
<P>#</P>
<P>#----------------------------------------------------------------------------</P>
<P>resource.loader = file</P>
<P>file.resource.loader.description = Velocity File Resource
Loader</P>
<P>file.resource.loader.class =
com.opencms.apache.velocity.OpenCMSResourceLoader</P>
<P><BR><BR>
</P>
<P>#add your own access path here</P>
<P>file.resource.loader.path =
.,/velocityTemplates/,/velocityTemplates/mail/,/velocityTemplates/newsletter/</P>
<P><BR><BR>
</P>
<P>#this is currently necessary to enable velocity internal
caching</P>
<P>resourcemanager.cache.class =
com.opencms.apache.velocity.SimpleHashtableCache</P>
<P>resourcemanager.cache.global = false</P>
<P>runtimeinstance.cache.class =
com.opencms.apache.velocity.SimpleHashtableCache</P>
<P>runtimeinstance.cache.global = false</P>
</TD>
</TR>
</TABLE>
<P><BR><BR>
</P>
<P>Download and compile files provided in opencms_velocity_03.zip
file. Add compiled files to OpenCMS occlasses(or oclib if jar). For
compiling these source files above mentioned library is required.</P>
<P><BR><BR>
</P>
<P>Similar to other java classes that provide bynamic content to
OpenCMS XML template. Define java class by extending
<A HREF="http://com.aditisoft.opencms.templates.VelocityTemplate/">com.aditisoft.opencms.templates.VelocityTemplate</A>.
For conventions of implementing extended class read java doc
provided in class or refer to the source.
</P>
<P>Create default velocity template for the project in
“content/velocityTemplates/” folder of vfs. Name of the
file should be “default”. This file is used for providing
a default content in case template file was not provided in
ELEMENTDEF.</P>
<P>VELOCITYELEMENT template declaration for use in ELEMENTDEF
declaration.
</P>
<P><?xml version="1.0"?></P>
<P><XMLTEMPLATE></P>
<P><VELOCITYELEMENT></P>
<P> <PROCESS>velocity_code</PROCESS></P>
<P></VELOCITYELEMENT></P>
<P><TEMPLATE></P>
<P> <PROCESS>VELOCITYELEMENT</PROCESS></P>
<P></TEMPLATE></P>
<P></XMLTEMPLATE></P>
<P>Imp: You may not have to change any thing in this declaration. You
should not be modifing <PROCESS>velocity_code</PROCESS>
element. velocity_code is key value hard coded in Java class
(VelocityTemplate).</P>
<P>ELEMENTDEF declartion:</P>
<P><ELEMENTDEF name="elementvelocity"></P>
<P><TEMPLATE>/content/elements/VelocityElement</TEMPLATE></P>
<P><CLASS>com.aditisoft.opencms.templates.VelocityTemplate</CLASS></P>
<P><PARAMETER name="TEMPLATEFILE"></P>
<P>/content/VelocityTemplates/hello</P>
<P></PARAMETER></P>
<P></ELEMENTDEF></P>
<P>ELEMENTDEF will be declared for almost every user action. Class
element takes name of the Java action class. The java action class
should be com.aditisoft.opencms.templates.VelocityTemplate or its
sub-class. This ELEMENTDEF also optionally includes parameter named “
TEMPLATEFILE ”. This takes name of the Velocity template for
generating the view. If this parameter is not provided velocity
template file name defaults to “content/velocityTemplates/default”.
</P>
<P>If action class implements more then one user actions, add another
parameter declaration for name of the user action. The user action
parameter value can be used for identifying user action in the
getContent method of action class.
</P>
<P><BR><BR>
</P>
<P><BR><BR>
</P>
<P><BR><BR>
</P>
<P><BR><BR>
</P>
<P><BR><BR>
</P>
<P><BR><BR>
</P>
</BODY>
</HTML>