We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 51057
    • 3 Posts
    Hi,

    I had a problem when I immigrate a static html website into MODX.
    Here's the process I tried.

    1. make a simplest template element having only [[*content]]
    2. on document resource, choose content type-HTML and uncheck the option of "rich text"
    3. copy and paste entire HTML code from existing webpage into content field on MODX

    Then after clicking save button, the loading notification didn't end.
    It doesn't go without head tag, but it works without any script tag in body.
    I guess that MODX analyses HTML tags when it save the content into a database.
    How can I use entire HTML source codes as a content of MODX?

    My MODX environment is as follows.

    MODX Revolution 2.4.0-pl (traditional)
    MySQL 5.6.13 utf8
    PHP 5.4.27

    I long for any helpful answer, thanks.

    This question has been answered by sottwell. See the first response.

      • 44064
      • 185 Posts
      Anton Tarasov Reply #2, 11 years ago
      Quote from: yokoiwa at Sep 08, 2015, 11:55 PM

      It doesn't go without head tag, but it works without any script tag in body.
      Hi yokoiwa,

      You have all the HTML code within the document content field - is that requirement strict? If no could you separate common repetitive HTML parts(f.e. head, header, footer blocks etc.) within separate chunks and edit your template according to the new elements. Ideally if you will have something like that:
      <html>
      [[$head]]
      <div class="main-content-field">
      [[*content]]
      </div>
      [[$footer]]
      </html>
      


      That is one of examples that can help you simplify the code/data addition/maintenance and solve the raised problem.
        Anton Tarasov
        MODX Developer

        Email: [email protected]
        Web: antontarasov.com
        • 28042 ☆ A M B ☆
        • 24,524 Posts
        That sounds very much like a server mod_security issue. Saving a resource, chunk or anything else is just submitting a form, and many hosting providers have security checks that won't allow a form submission that contains - well, anything they have set to not be allowed. Words, like "casino", can be blocked, anything suggestive of email, and often script tags are blocked.

        The solution is to speak with your hosting provider's tech support. They can look at their security logs to see what rule your offending submission broke, and whitelist your site for that rule.

        In some rare cases they won't help, in which case the only solution is to change to a different hosting provider that will.
          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
          • 28042 ☆ A M B ☆
          • 24,524 Posts
          As far as using a separate template goes, it's not really necessary. If a resource is assigned no template - (empty) - then MODX will simply use the resource content instead. Or, you can assign a template that has nothing in it for the same effect. The only advantage to that would be if you want to have Template Variables for the resource in question, or want to categorize the resources by template for some reason.
            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
            • 51057
            • 3 Posts
            Hi himurovich,
            I appreciate your quick response!

            I made a new template variable to put script tags code in.
            (input: multi line text, output: default / text)
            But it still doesn't work with any <script> or <link> tag.
            (with <meta> or other tags, it works)

            It seems that MODx refuses these tags as a content of resources...
            • discuss.answer
              • 28042 ☆ A M B ☆
              • 24,524 Posts
              I'll bet you can't have script tags in a chunk or a template either. It's nothing at all to do with MODX, it's a server security setting.
                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
                • 51057
                • 3 Posts
                sottwell,

                As you say, I cannot use <script> and <link> tags in a chunk and a template too.
                Problems of the server security (and the hosting service) were entirely out of my mind.

                Really thanks for your advises!
                I will get contact with the hosting company and try to solve it.