Dheeraj Agrawal
Dheeraj Agrawal

Reputation: 2357

Velocity Template #set query

I am trying to use #set and declaring the variable but don't know why it's not working. Below is my code:

#set( $emailContent = '<tr>
  <td style="color:#000;font-size:12px;line-height:16px;font-family:Arial;text-align:left;padding-top:15px" >
    <p style="font-size:12px;padding-top:15px;padding-bottom:15px">
        $userFirstName,<br /><br />
        Your sample account has been unlocked by your administrator. You should now be able to log back into your account. If you have further difficulty logging in, use the "Forgot password" link on the login page or contact your administrator for assistance.
    </p></td>
</tr>' )

I am wondering that is it important to declare $emailContent in server-side before using it with #set.

Please help.

Upvotes: 0

Views: 1055

Answers (1)

Nathan Bubna
Nathan Bubna

Reputation: 6933

No, you should not have to declare it in java before using it with #set. But the way you phrased it, makes it sound as though not everything is "server-side", which it should be. Velocity is processed on the server, not on the client. Also, not every version of Velocity supports multi-line string literals (as in your example). Make sure you are on the latest version.

Upvotes: 1

Related Questions