On Sun, 2002-05-26 at 05:35, rpiper wrote:
> I would like to be able to parse velocity code from a string, rather 
> than a vm template.
> So rather than:
> 
> #parse("filename.vm")
> 
> do something like:
> 
> #evaluate(" This is a $test, of velocity ") , where say $test is a 
> string object on the context.
> 
> I would be grateful for any suggestions.
> 
> Basically I want to store the navigation templates in a database, and 
> therefore need to be able to evaluate
> these from within other navigation or screen templates as a string 
> (rather than template file), retrieved from a database..
> 
> thanks

#evaluate ( $dbTool.getVTL("siteNavigation") )

You could make a little tool that retrieves your VTL from the database
and you can use that directly as a parameter to the evaluate directive.

I can't remember if #evaluate is even a directive so you might have to
make a tool to do the evaluations for you, but in either case I don't
think you will have much problem getting this working.

Have you look at the DataSourceResourceLoader in velocity yet? You could
also use this to get VTL from a DataSource.

http://cvs.apache.org/viewcvs/jakarta-velocity/src/java/org/apache/velocity/runtime/resource/loader/DataSourceResourceLoader.java?rev=1.8&content-type=text/vnd.viewcvs-markup

There are also some docs on the DataSourceResourceLoader in the vel
docs:

http://jakarta.apache.org/velocity/developer-guide.html#Resource%20Loaders


> Richard
> 
> -- 
> Richard Piper
> 
> http://icu-web.org
> mail:[EMAIL PROTECTED]
> 
> 
> 
> 
> 
> 
> --
> To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
-- 
jvz.

Jason van Zyl
[EMAIL PROTECTED]

http://tambora.zenplex.org


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

Reply via email to