We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 19369
    • 1,098 Posts
    You shouldn't put code in the [*content*], the RichText editor (probably TinyMCE) will add the <p> tag automatically. Use [*content*] only for adding plain text and images.

    If you want to add code directly in the resource use Template Variables, otherwise put the code directly in templates and chunks.
    • That is because of your Rich Text editor; there is a setting for it called "forced-root-block", where anything it sees that doesn't have a block element such as <p> or <div> surrounding it automatically gets a <p> put around it. You can disable this in the TinyMCE plugin's configuration, but then if you just enter text into the content field it won't put the <p> tags around it.

      To stop it from putting the tags at all, in the TinyMCE plugin's configuration tab, in the "custom configuration" field, put
      forced_root_block : false


      You could also set the forced_root_block value to be 'div' instead of 'false', then it would put div tags that you could ignore or style as desired in your css.

      What I sometimes do in such a case is put the entire block of content that has the MODx tags in a chunk, then in the HTML view in the editor add <div> tags around the chunk tags so TinyMCE doesn't need to add its own tags. The best way to deal with it depends on what exactly you're trying to do.

      One side note here; I often find it very convenient to have a TV for a classname or ID for using in the body tag so that I can style certain elements in a single page by specifying that body class (or ID) in the css.
      <body class="[*bodyclass*]">

      The default TV value can be something like "normal" so it will be applied to most pages, or it could even be @INHERIT so that you can have entire sections of your site using the same classname for styling simply by editing the TV for the parent 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
        • 38310
        • 23 Posts
        Thanks for the input so far. I fell so lucky that i have learned a lot from you and microcipcipI. I often use the bodyclass to relise the effect of current navigation status.