Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

Template Questions /

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo, swaiba

If blocks in email templates?


Go to End


2 Posts   1650 Views

Avatar
plautzer

Community Member, 10 Posts

15 March 2010 at 7:36am

Edited: 15/03/2010 7:37am

Hello,

is there a way to use if statements in email submussion forms? When I use the template if blocks:

<% if $checkbox %> Write Hello <% end_if %>

I always get follwoing error:

Parse error: syntax error, unexpected '}' in ../email_template.ss on line 107

Do u know how to get this to work?

thx,
Plautzer

Avatar
dhensby

Community Member, 253 Posts

15 March 2010 at 11:59am

In the templating language one doesn't use $ to assign variables / functions within the opening and closing brackets (<% %>)

So it is like this:

<% if checkbox %>
$Message
<% end_if %>