We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 25287
    • 81 Posts
    I'm using modx 2.2.0pl2 and having problems with getting chunks to work in the css for the site.

    In an earlier version of Revo I was able to have the css as a non-templated document within the datbase. Within that I used a number of chunks to stare the color values. That way it was simply a matter of changing a few chunks to adjust colors.

    Since upgrading to 2.2.0 the css document will not save if it is edited at all. To get around that I tried putting the same css into a file, and adjusting the templates to read that file.

    That works, except that the file version of the css does not use the chunk values.

    Is there something I'm missing, or some simple way to do the same thing?

    Thanks for any help.
      • 40447
      • 165 Posts
      Hi, I'm not sure what you mean by "except that the file version of the css does not use the chunk values" I made folders in the directory tree of modx and named them simply css and js. I put most of my css and js as external files in those folders and call them with chunks inside my pages. This works without any problem. If something is not working right simply replicate your page in a temporary folder on your computer and handcode your css and js inside the page. Doing so you can debug the css and js. When you got that working remove the handcoded css and js and move them as external files inside modx.
        • 28042 ☆ A M B ☆
        • 24,524 Posts
        Using a resource as a CSS file should work. Are you sure that the document type is set to text/css?
          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
          • 39932
          • 483 Posts
          Making sure I got this correct:

          1) You have a CSS (as a Resource with no Template) and want to import chunks so that you can make quick edits to change the entire look of several styles (like theming). However, since you upgraded, the resource no longer parses the chunks.

          2) As a workaround, you created a file version which loads, but is completely static so the chunks cannot be read.

          Assuming that I got this correct, the issue is really simple to solve. You have multiple ways to accomplish this. If you want the CSS to be parsed, it must be a Resource (unless you want to manually force the parser).

          Move it back into the Resource. Second, set the Content Type (on the Settings Tab) to "css". Once it is set to CSS, you have a couple of options. The old tutorials for CSS as a Resource tell you not to use a Template. This information is outdated and no longer required. Not using a Template actually limits you in Revo 2+.

          You can set it to use a Template and it will be parsed in full by ModX. Simply make a Template that only has
          [[*content]]
          and set your CSS Resources to use the new Template. This should resolve any parsing issues you might have. (I actually have my CSS Template run a couple of Snippets and process Template Variables!) It will still "render" fully as CSS for you as long as you have the Content Type set to "css".
            Website: Extended Dialog Development Blog: on Extended Dialog
            Add-ons: AJAX Revolution, RO.IDEs Editor & Framework (in works) Utilities: Plugin Compatibility List
            Tutorials: Create Cross-Context Resources, Cross-Context AJAX Login, Template-Based Actions, Remove Extensions from URLs

            Failure is just another word for saying you didn't want to try. "It can't be done" means "I don't know how".
            • 3749
            • 24,544 Posts
            It sounds to me like your real problem is not being able to save chunks with CSS in them. That would most likely be due to modx_security (assuming that you can save other chunks) http://wiki.modxcms.com/index.php/What_is_mod_security_and_how_does_it_affect_me .



            ------------------------------------------------------------------------------------------
            PLEASE, PLEASE specify the version of MODX you are using.
            MODX info for everyone: http://bobsguides.com/modx.html
              Did I help you? Buy me a beer
              Get my Book: MODX:The Official Guide
              MODX info for everyone: http://bobsguides.com/modx.html
              My MODX Extras
              Bob's Guides is now hosted at A2 MODX Hosting
              • 39932
              • 483 Posts
              That is a super handy document! (Why have I never read it before?!) Since robinqld hasn't responded, it's still up in the air as to whether it applies. I got the impression from the OP's post that the chunks were actually saved successfully, but they stopped working. Would ModX security still affect that? (The document says that its applies mostly to POST data)
                Website: Extended Dialog Development Blog: on Extended Dialog
                Add-ons: AJAX Revolution, RO.IDEs Editor & Framework (in works) Utilities: Plugin Compatibility List
                Tutorials: Create Cross-Context Resources, Cross-Context AJAX Login, Template-Based Actions, Remove Extensions from URLs

                Failure is just another word for saying you didn't want to try. "It can't be done" means "I don't know how".
                • 28042 ☆ A M B ☆
                • 24,524 Posts
                That has nothing to do with MODx, that's a server cofiguration. There are several security applications, suhosin is one of the more popular ones. Mostly they scan all your POST values when a form is submitted, and refuse to allow something to be used if it is in its blacklist.
                  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