Jump to:

17452 Posts in 4473 Topics by 1971 members

Archive

SilverStripe Forums » Archive » Comments in the templates

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: 1233 Views
  • KatB
    Avatar
    Community Member
    94 Posts

    Comments in the templates Link to this post

    I am sure this is obvious and I am sure my question makes all experienced SS developers and users groan, but

    Can I put comments in a template so that the next time I read the template I can understand the thinking behind the code, but it doesn't get translated for the browser? And if so, what does those comments look like?

  • Willr
    Avatar
    Forum Moderator
    5508 Posts

    Re: Comments in the templates Link to this post

    you have to use normal html comments I guess for your templates <!-- this is a comment --> if you don't want it to show up in the browsers view source you could create a method in Page called Comment so you would have

    function Comment() {
    return false
    }

    then in the template you could use <% if Comment %><!-- Write all your notes in here --><% end_if %>

    1233 Views
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.