We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 22221
    • 283 Posts
    Is it possible to use a ModX document as CSS and to use it in the configuration of the WYSIWYG Editor (configuration panel) ?

    The possibility to use CSS as Modx document is very powerfull smiley but I think the CCS file path is not not parsed sad
      • 17883
      • 1,039 Posts
        • 22221
        • 283 Posts
        OK thanks smiley,
        I know that is possible but I wonder if the CSS file path (in the configuration panel) can use a document ID ?
          • 17883
          • 1,039 Posts
          Why configuration panel? The CSS is defined in each template afaik... wink
            • 22221
            • 283 Posts
            Why configuration panel? The CSS is defined in each template afaik...

            When you want to use the WYSIWYG editor with your CSS file to have a preview in the editor wink
              • 22221
              • 283 Posts
              Quote from: OncleBen31 at May 05, 2006, 01:15 AM

              [...] I wonder if the CSS file path (in the configuration panel) can use a document ID ?

              Nobody have the answer ?

                • 4018
                • 1,131 Posts
                At the moment, no, you can’t use the document ID as part of the path to the CSS document. For instance, if I had a CSS document with an alias of sitestyle.css and a document ID of 35, this wouldn’t work:

                <style type="text/css" media="all">
                @import url('[(site_url)][~35~]');
                </style>
                


                The reason is that the parsed code would turn into this:

                <style type="text/css" media="all">
                @import url('http://www.mysite.com/sitestyle.css.html');
                </style>
                


                The problem is the .html at the end. Although alot of browsers will still work with this, Internet Explorer won’t and thus your CSS code isn’t used. The only way to get Internet Explorer to work is to not have an .html extension...just a .css extension. Thus, something like this would work:

                <style type="text/css" media="all">
                @import url('[(site_url)]sitestyle.css');
                </style>
                


                The other links provided in this thread go over the issue a bit more in detail.
                  Jeff Whitfield

                  "I like my coffee hot and strong, like I like my women, hot and strong... with a spoon in them."
                  • 22221
                  • 283 Posts
                  I’m not sure you understand what I wonder. tongue May be I’m not clear
                  I notice the solution to use a ModX document for CSS file. -> OK

                  BUT I WONDER if there is a way to use this document in the configuration of the manager : in manager / panel admin / sub-panet configuration / editor configuration / field CSS field path huh

                  I bet this is not possible, but perhaps can we add this to the wish list ?
                    • 25663 MODX Staff
                    • 12,272 Posts
                    can’t be done now as you surmised. at least i don’t think as it expects a regular file path. add it to the wishlist on the bugtracker please.
                      Ryan Thrash, MODX Co-Founder
                      Follow me on Twitter at @rthrash or catch my occasional unofficial thoughts at thrash.me
                      • 4018
                      • 1,131 Posts
                      Quote from: OncleBen31 at May 10, 2006, 08:28 AM

                      BUT I WONDER if there is a way to use this document in the configuration of the manager : in manager / panel admin / sub-panet configuration / editor configuration / field CSS field path huh

                      I bet this is not possible, but perhaps can we add this to the wish list ?

                      It is possible. In fact, I just tried it out by populating the "Path to CSS file" field under "Interface & Editor Setting" in the System Configuration with a MODx-based CSS document and it worked fine. Main thing is to use the full path with the alias name of the document. Worked great for me. However, depending on how the CSS is formatted you may end up with unpredictable results...especially with FCKEditor. TinyMCE works better for this and even populates the Styles dropdown with the classes in the CSS. However, it does not populate it with highly complex classes or the ID’s of the CSS document. What I would do is create a separate CSS document that is written specifically for the RichText Editors. The benefit is that you can tweak the CSS so that the dropdowns are correct and so that the code is rendered correctly to mimic how the content might look when it’s published. It’s a bit of extra work...but the results are more than worth it. smiley
                        Jeff Whitfield

                        "I like my coffee hot and strong, like I like my women, hot and strong... with a spoon in them."