3435 Posts in 1026 Topics by 866 members
|Go to End|
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,
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. ;)
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.
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.
|Go to Top|