Jump to:

17452 Posts in 4473 Topics by 1971 members


SilverStripe Forums » Archive » Embedded HTML

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

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

Page: 1
Go to End
Author Topic: 1131 Views
  • remarkable
    1 Post

    Embedded HTML Link to this post

    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"/>

  • Willr
    Forum Moderator
    5508 Posts

    Re: Embedded HTML Link to this post

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

Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.