We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 25679
    • 37 Posts
    Rubendoliveira Reply #1, 17 years ago
    Hi,

    I’m having some issues with TV and Rich text.

    On my template I have something like this:

    <p>[*TV*]</p>


    And TV is defined as Rich text. When I write something on it, source code results on something like this:

    <p><p>Some text</p></p>


    Any ideas why is this happening? My page is not valid due to this errors.


    Thanks in advance.
      • 20413
      • 2,877 Posts
      TinyMCE does this automatically.
      Try this --> http://modxcms.com/forums/index.php/topic,28908.msg218397.html#msg218397

      If you would start with a <h1> or something you would only have </p> in the end.
        @hawproductions | http://mrhaw.com/

        Infograph: MODX Advanced Install in 7 steps:
        http://forums.modx.com/thread/96954/infograph-modx-advanced-install-in-7-steps

        Recap: Portland, OR (PDX) MODX CMS Meetup, Oct 6, 2015. US Bancorp Tower
        http://mrhaw.com/modx_portland_oregon_pdx_modx_cms_meetup_oct_2015_us_bancorp_tower
        • 22840
        • 1,572 Posts
        I usually use this:
        <div>[*TV*]</div>


        That stops it putting it in a p tag grin
          • 25679
          • 37 Posts
          Rubendoliveira Reply #4, 17 years ago
          Hi,

          Mrhaw, that’s it. Thank you for the link.

          Paulp, I have styles applied to <p> tag, so I need <p> there smiley


          The link Mrhaw gave is the solution.


          Thank you both.


          Kind regards!
            • 25679
            • 37 Posts
            Rubendoliveira Reply #5, 17 years ago
            I solved the <p> additional tags, however, the problem now is that when I copy any kind of text (even text without any kind of style) it stays like this:

            <p><div>text...</div></p> 


            It applies additional <div> tags which removes my css font styles! Even if I remove formatting.

            The only way it stays normal is write everything, which is bad for long texts that are already written.

            Any ideas?


            Thanks in advance.
              • 20413
              • 2,877 Posts
              PHx maybe can help you here!
              Install PHx plugin
              http://modxcms.com/forums/index.php/topic,40839.msg246407.html#msg246407

              Then install a modifier snippet -> http://wiki.modxcms.com/index.php/PHx/CustomModifiers#phx:striptags
              phx:striptags
              <?php
              return($modx->stripTags($output, $options));
              ?>


              Now use
              [*TV:striptags=`<div>`*]
                @hawproductions | http://mrhaw.com/

                Infograph: MODX Advanced Install in 7 steps:
                http://forums.modx.com/thread/96954/infograph-modx-advanced-install-in-7-steps

                Recap: Portland, OR (PDX) MODX CMS Meetup, Oct 6, 2015. US Bancorp Tower
                http://mrhaw.com/modx_portland_oregon_pdx_modx_cms_meetup_oct_2015_us_bancorp_tower
                • 25679
                • 37 Posts
                Rubendoliveira Reply #7, 17 years ago
                Thank you so much.

                I will try it right away.
                  • 25679
                  • 37 Posts
                  Rubendoliveira Reply #8, 17 years ago
                  Didn’t work. Stays the same.

                  And now I just found another issue. Sometimes, when I remove all the text, a white square appears and the sourcecode is this:

                  <span style="font-family: 'Times New Roman'; font-size: medium;"> 
                  <div style="color: #000000; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 10px; background-image: initial; background-repeat: initial; background-attachment: initial; -webkit-background-clip: initial; -webkit-background-origin: initial; background-color: #ffffff; background-position: initial initial; margin: 8px;">


                  So there is definitly something wrong with my text editor!
                    • 15175
                    • 116 Posts
                    As TinyMCE adds <p> tags to a rich text TV automatically, why not just leave them out of the template?
                      • 25679
                      • 37 Posts
                      Rubendoliveira Reply #10, 17 years ago
                      Because it is random! I have just restored tiny_mce.js and on the top TV text it’s normal and the bottom it’s <p><p></p></p>

                      Tiny is getting me crazy with so many bugs!

                      EDIT:

                      Okay, here’s the situation:

                      - On my tiny_mce.js forced_root_block is set to false
                      - I have installed phx:striptags and I’m removing <div> tags since I was getting additional <div> tags
                      - The way I’m using the phx snippet is:
                      <p>[*orange:striptags='<div>'*]</p>
                      with `<div>` it doesn’t work and without the snippet it adds additional <p> instead of <div> (even with forced_root_block set to false!)

                      All this is weird to me.. it makes on sense at all! Initially, it was adding <p> tags and I set forced_root_block to false and it really removed <p> tags but than <div> tags appeared. To remove <div> tags I used the phx:striptags function and it wasn’t working.. I than changed `<div>` to ’<div>’ and the additional <div> tags are now gone.

                      So it’s all working for now but making no sense... because if I remove the phx:striptags the initial issue (additional <p> tags) appears again. The behaviour is a bit random and I’m afraid of that.


                      Best regards and thank you for all your support!