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.

General Questions

General questions about getting started with SilverStripe that don't fit in any of the categories above.

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

Remove template comments


Reply

7 Posts   1982 Views

Avatar
DeklinKelly

9 May 2009 at 12:55am Community Member, 197 Posts

How do I remove template comments from the generated HTLM?

<!-- template E:/wamp/www/ss/themes/simple/templates/Page.ss -->


<!-- end template E:/wamp/www/ss/themes/simple/templates/Page.ss -->

What should I put in Page.ss to prevent these comments from being displayed

Avatar
banal

9 May 2009 at 1:03am Community Member, 901 Posts

As far as I know these comments only show in Dev mode. Eg. when you run your site on localhost.

Avatar
DeklinKelly

2 June 2009 at 9:28pm Community Member, 197 Posts

These codes are causing me grief even in Dev mode on localhost.

IE7 does NOT like comments before the document type definition. It causes the whole page to be rendered incorrectly!

How can I get rid of these comments?

<!-- template /home/mysite/html/ss/themes/atom/templates/mypage.ss -->
<!-- include /home/mysite/html/ss/themes/atom/templates/Includes/Header.ss -->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">

Avatar
Howard

2 June 2009 at 9:49pm Community Member, 215 Posts

Yea as banal said, these comments only occur when the site is in Dev mode - once you put the site into live mode then the comments disappear :)

Avatar
DeklinKelly

2 June 2009 at 10:07pm Community Member, 197 Posts

How can I make them go away even in dev mode? They are breaking my site so I can't even test it!

Avatar
banal

3 June 2009 at 12:15am Community Member, 901 Posts

Maybe you should not put include statements before the <!DOCTYPE
Since you'll never want anything before that doctype tag, you shouldn't add an include there to begin with!

If I'm making false assumptions, and you're not including anything before the doctype tag, please share your template code with us...
I for one haven't encountered this problem yet.

Avatar
Ben Gribaudo

3 June 2009 at 12:28am Community Member, 181 Posts

Hello,

Inserting

SSViewer::set_source_file_comments(false);


in your _config.php file should turn these comments off.

Ben