Jump to:

23377 Posts in 18296 Topics by 2867 members

General Questions

SilverStripe Forums » General Questions » Remove template comments

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

Page: 1
Go to End
Author Topic: 1960 Views
  • DeklinKelly
    Avatar
    Community Member
    197 Posts

    Remove template comments Link to this post

    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

  • banal
    Avatar
    Community Member
    901 Posts

    Re: Remove template comments Link to this post

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

  • DeklinKelly
    Avatar
    Community Member
    197 Posts

    Re: Remove template comments Link to this post

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

  • Howard
    Avatar
    Community Member
    215 Posts

    Re: Remove template comments Link to this post

    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

  • DeklinKelly
    Avatar
    Community Member
    197 Posts

    Re: Remove template comments Link to this post

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

  • banal
    Avatar
    Community Member
    901 Posts

    Re: Remove template comments Link to this post

    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.

  • Ben Gribaudo
    Avatar
    Community Member
    181 Posts

    Re: Remove template comments Link to this post

    Hello,

    Inserting

    SSViewer::set_source_file_comments(false);


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

    Ben

    1960 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.