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

Comments in the templates


Go to End


2 Posts   1516 Views

Avatar
KatB

Community Member, 105 Posts

28 February 2008 at 1:37pm

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?

Avatar
Willr

Forum Moderator, 5523 Posts

28 February 2008 at 8:26pm

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