This might seem extremely simple but I can't seem to comment out a block in a cms page. Here is part of my code:

<div class="contact-form">
{{block type="core/template" name="contactForm" 
form_action="/contacts/index/post" template="contacts/form.phtml"}}
<div class="contact-map">

I want to comment out the entire contact form but I can't seem to get comments to work. I've also tried the /* ... */ comments block.


I have also noticed that on the webpage only the exiting comment block code is being rendered i.e --> is visible on the frontend. Could the form.phtml be exiting the comment block somehow?

Please help

  • Have you ensure that the cache has been cleared after you have commented it out? (Also worth checking the actual file has changed if it is on a remote server, something could go wrong!)
    – tim.baker
    Oct 5, 2016 at 22:14
  • Yes the comment block code just appears on the page i.e. I can see /* before and */ after the contact form on the page
    – Pragman
    Oct 5, 2016 at 22:37

2 Answers 2


Update: the problem is that you have an HTML comment in contacts/form.phtml. Magento will parse the widget inside of your comment and load all of the HTML in from the template that you referenced. If you have no comments in your .phtml file, it will render correctly, or rather, not render at all due to the comment.

Since CMS pages render as HTML, the correct way to comment is <!-- -->.

Make sure that you add the comment in the HTML view. If you enter the comment in the WYSIWYG editor, it will escape those characters which will then render to front end.

Also, make sure that you are editing the correct store's version, if on a multi-store shop, and clear the cache after making the changes if you still don't see the change.

  • Like I said in my question I have tried the <!-- --> option but it does not work. Cache is disabled.
    – Pragman
    Oct 5, 2016 at 23:30
  • @ZUBU, I updated my answer. I do know for a fact that <!-- --> is the way to comment HTML. Magento doesn't have a custom commenting approach (to my knowledge) and as such <!-- --> is the only way to temporarily hide that in your page. However, in your case, you will need to disable the template because it has a comment in it. You can disable the widget by removing a curly brace from each side. Oct 5, 2016 at 23:39
  • 1
    Using <!-- --> and removing a curly bracket {} worked thanks.
    – Pragman
    Oct 6, 2016 at 1:00

Try moving code onto one line like this, so that Magento will not auto-add < p> tags to your code:

<!-- div class="contact-form" /* {{block type="core/template" name="contactForm" form_action="/contacts/index/post" template="contacts/form.phtml"}} */ </div -->
<div class="contact-map">

Tested on Magento

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.