Good catch on the RenderTool Shane. I have tried this myself in the
past.  However it is not recursive, which makes nesting content a little
difficult.

I am able to pull my Velocity pages from other servers (remove if
desired) other than my app server, and render them using my approach.

You are probably thinking who cares.  (You are probably right).

Using an approach like I showed you, I am intercepting the calls for my
page content.  I can then substitute in a language translated page, and
in other cases a different version of a page (we re-use our products
with multiple business partners, and need to re-brand them for each).
This all happens without having to re-build any business logic,
formatting, changing any page links, etc.  We can add in a new version
of a page on the fly without changing any existing code, forms, etc.

By the way, we are only using Turbine and Velocity macros to accomplish
this.

-----Original Message-----
From: Shane Beasley [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, March 29, 2006 2:08 PM
To: Turbine Users List
Subject: Re: Expression evaluation inside a template?

BoD wrote:

>  So I would need something like eval($expr) that would evaluate the
>  content of $expr which is $obj.getProp(). Obj being declared before
>  it would call the method and return "hello".

You might be interested in RenderTool, a component of the VelocityTools 
package. Its eval() method is particularly useful:

http://jakarta.apache.org/velocity/tools/generic/RenderTool.html#eval()

Example code:

#set( $list = [1,2,3] )
#set( $object = '$list' )
#set( $method = 'size()' )
$render.eval($ctx, "${object}.$method")

Example output:

3

Or, in your case, you would use $render.eval($ctx, $expr) to do what you

need.

Shane

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


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

Reply via email to