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.

Archive /

Our old forums are still available as a read-only archive.

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

Embedded HTML


Go to End


2 Posts   1475 Views

Avatar
remarkable

1 Post

3 October 2007 at 3:28pm

Edited: 03/10/2007 3:41pm

Just wondering about ways to embed SS variables in HTML.
I'm doing the following:

<% control Days %>
<span><img src="$DayNo.png"/></span>
<% end_control %>

$DayNo is my variable, and I have several .png pictures (1.png, etc) to display. I know the . is for method calls, so is there any way to avoid this?

EDIT: Found the answer: curly braces.
<img src="{$DayNo}.png"/>

Avatar
Willr

Forum Moderator, 5523 Posts

3 October 2007 at 4:16pm

Yes {} is the way to go. don't forget your alt tags on your images :D