We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 37437
    • 147 Posts
    Is there any way to add comments to chunks? Since chunks are raw HTML, I figured I could add standard HTML comments ’<!-- -->’ to the code. I was wrong; doing so created all sorts of problems in IE7 -- and not simply on the page that called the chunk in question, but throughout the entire site. Is there a workaround for this or is it simply not recommended that you put comments in your chunks?
      • 28042 ☆ A M B ☆
      • 24,524 Posts
      Of course HTML comments can be in a chunk. And how can a chunk have any effect whatsoever on pages that don’t use it? This is extremely odd.

      Do you use the TinyMCE rich text editor? Do you enter the HTML comments directly into the editor field, or into the html/code window? Can you post an example of a chunk that caused problems? And can you give a more specific description of the problems that are occurring?
        Studying MODX in the desert - http://sottwell.com
        Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
        Join the Slack Community - http://modx.org
        • 37437
        • 147 Posts
        In retrospect, I overstated the case, when I indicated that the chunk in question has an effect on pages that don’t explicitly use it (sorry about that). However, adding comments to the offending chunk does in fact create significant problems for the site in IE7. Here is the code:

        <h2>Links</h2>
        <div id="links">
        
        <!--This is a comment. -->
        <p><a title="Test Link1" href="http://www.testlink1" target="two">Test Link1</a></p>
        <p><a title="Test Link2" href="http://www.testlink2.com" target="two">Test Link 2</a></p>
        <p><a title="Test Link3" href="http://www.testlink3.com" target="two">Test Link 3</a></p>
        <!--This is a comment. -->
        
        </div>
        
        


        If I leave the comments in the code above, any page that calls the chunk will display very improperly in IE7 (namely, most of the page content will not even display). I have tried this numerous times, and reliably, I get the same troubling result. As soon as I remove the comments, the problem disappears. Can’t seem to get my head around it.
          • 28042 ☆ A M B ☆
          • 24,524 Posts
          What happens if you put the exact same content (comments and all) directly into a document’s content?

          Have you checked W3C validation on one of the offending pages?
            Studying MODX in the desert - http://sottwell.com
            Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
            Join the Slack Community - http://modx.org
            • 37437
            • 147 Posts
            Sottwell, you are good. Found a rogue html comment in the site template. I removed the offending characters and IE is happy again.
            Thank you very much for your insights.