3212 Posts in 847 Topics by 809 members
|
Page:
1
|
Go to End | |
| Author | Topic: | 1920 Views |
-
Commenting out code in templates

20 February 2009 at 2:24pm
Hi, my name's David - I'm new here
I've installed Silverstripe and I'm so impressed that I'm using it for two sites I'm doing at the moment. I'm playing around with templates and want to know if it's possible to comment out code.
I can use HTML's <!-- --> but the template code still gets processed.
I'm looking at the BrightSide1 template which spews out errors if you don't have a page called 'Blog'. I want to comment out that code, in the .ss file so I can refer to it later. Is this possible?
My apologies if there's some reference somewhere that explains this - I searched through the docs and the forums and couldn't find anything.
Thanks in advance,
David. -
Re: Commenting out code in templates

22 February 2009 at 2:29am
Welcome to Silverstripe ! Good choice ! ;-)
That is a good question .. I remember there was talk about this some time ago...
Kinda' forgot wat the outcome was..but AFAIK it has not been implemented yet. ;)
-
Re: Commenting out code in templates

22 February 2009 at 12:34pm
Thanks fuzz, I appreciate it!
I've had a cursory look at parseTemplateContent() in sapphire/core/SSViewer.php , and I can see where it's processing the <!-- --> - I don't think it'd be too hard to modify my own version so that the stuff inside html comments doesn't get processed.
I know comments are nothing huge and I could just make a backup of the template file, but I find it helpful to comment out code when I'm learning something new, it helps me pinpoint where my bugs are.
thanks again
-
Re: Commenting out code in templates

18 September 2011 at 11:08pm Last edited: 18 September 2011 11:09pm
It's documented here: http://doc.silverstripe.org/sapphire/en/reference/advanced-templates#comments
Comments in .ss files like this...
<%-- this is a comment --%>
...must have the start & end tags on the same line, so this will not work...
<%--
<p>comment this out temporaily for debugging purposes</p>
<div>and this too etc...</div>
--%>...which is a pity. It would be useful.
| 1920 Views | ||
|
Page:
1
|
Go to Top |


