Ok, the example listed was just to show it worked... I had thought that 
eval would be useful in building reusable macros. This is a real world 
example. If there is a better way to make this happen please let me know, 
but this seemed useful right now.

## Include file
#macro (target $targeter $perElement)
#set ($targeting=$req.resolveName($targeter))
 #foreach ($item in $targeting.target($req))
        #eval($perElement)
 #end
#end

## Actual VM
#target("AllNewsletters" '<li> $item $item.shortName</li>')
#target("CustomNewsletters" '<li> $item $item.shortName</li>')

Using two different content targeting models this should list the names of 
all the relevant content. What is the correct non-eval way?

-Ben





Jon Stevens <[EMAIL PROTECTED]>
04/05/2001 03:14 PM
Please respond to velocity-dev

 
        To:     <[EMAIL PROTECTED]>
        cc: 
        Subject:        Re: AbstractExecutor/Eval


on 4/5/01 12:02 PM, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]>
wrote:

> #set ($foo='this is some $text $!bar')
> #set ($text="foo")
> #set ($bar="bar!")
> #eval($foo)

Why not just:

#set ($text="foo")
#set ($bar="bar!")
#set ($foo="this is some $text $!bar")

?

I don't think we need a #eval. This has already been discussed on the 
list.

-jon




Reply via email to