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're retiring the forums!

The SilverStripe forums have passed their heyday. They'll stick around, but will be read only. We'd encourage you to get involved in the community via the following channels instead:

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   1349 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