improvate #evaluate example
---------------------------

                 Key: VELOCITY-603
                 URL: https://issues.apache.org/jira/browse/VELOCITY-603
             Project: Velocity
          Issue Type: Improvement
          Components: Documentation
            Reporter: Will Glass-Husain
            Priority: Minor
             Fix For: 1.6



---------- Forwarded message ----------
From: Luan Nguyen <[EMAIL PROTECTED]>
Date: Mon, Oct 22, 2007 at 8:56 PM
Subject: Evaluate Section
To: [email protected]


Hello,In the Evaluate section, there are two different variables: $source1
and $source.  How can it display "abc" when $source is never defined?

Evaluate

The *#evaluate* directive can be used to dynamically evaluate VTL. This
allows the template to evaluate a string that is created at render time.
Such a string might be used to internationalize the template or to include
parts of a template from a database.

The example below will display abc.

#set($source1 = "abc")
#set($select = "1")
#set($dynamicsource = "$source$select")
#evaluate($dynamicsource)




---------- Forwarded message ----------
From: Will Glass-Husain <[EMAIL PROTECTED]>
Date: Tue, Oct 23, 2007 at 9:55 AM
Subject: Re: Evaluate Section
To: Velocity Developers List <[email protected]>


That's a good point though.  Perhaps the example should use concatenation to be 
clearer. The single quotes prevent evaluation.

#set($dynamicsource = '$source' + "$select")

WILL

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


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

Reply via email to