We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 3749
    • 24,544 Posts
    Is this used by MODx in any way (and if so, how), or is it just there for editors and such.
      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
      • 10487 MODX Staff
      • 1,535 Posts
      Content type is definitely used but it depends a lot on the purpose of the page.

      For example, a MODx page can be used to dynamically generate an image and that’s where the content type becomes invaluable. It’s the difference between displaying a nice PNG image or a bunch of binary-encoded gobbledygook in the browser smiley
        Garry Nutting
        Senior Developer
        MODX, LLC

        Email: [email protected]
        Twitter: @garryn
        Web: modx.com
        • 3749
        • 24,544 Posts
        Interesting, I’d like to know more about the possibilities of using this.

        Has anyone used a setting other than 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
          • 22303 MODX Staff
          • 10,725 Posts
          Quote from: BobRay at Mar 04, 2009, 03:31 PM

          Interesting, I’d like to know more about the possibilities of using this.

          Has anyone used a setting other than HTML?
          You can now use any valid content type you want to add to the table, as long as you appropriately configure it as binary or not (i.e. text).  You can use Static Resources or regular Resources (aka Documents) to represent or construct them dynamically with Snippets and/or Plugins, and you can even import entire static sites into the tree, including HTML, CSS, JS, Word Docs, PDFs, etc.

          In addition, the downloads on the MODx site are Static Resources being delivered as the appropriate ZIP and TAR.GZ mime-types using this technique.
            • 3749
            • 24,544 Posts
            Ok, that gets me a closer, but I still don’t see what that setting actually does or what an end user might do with it.

            Under what circumstances would you want to have a document that contained nothing but JS or CSS, for example.

            I’ve already used documents to hold straight text without changing the content type and it worked fine.
              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
              • 28215
              • 4,149 Posts
              Quote from: BobRay at Mar 04, 2009, 10:49 PM

              Under what circumstances would you want to have a document that contained nothing but JS or CSS, for example.
              If you wanted to provide a dynamic, snippet-driven javascript (say, JSON data), or dynamic CSS.

              The MODx Package Management in Revo connects to Providers that a Resources with a .js content type, and a snippet call in them to generate the JSON.


              I’ve already used documents to hold straight text without changing the content type and it worked fine.
              Some browsers (safari) don’t like this, and throw warnings.
                shaun mccormick | bigcommerce mgr of software engineering, former modx co-architect | github | splittingred.com
                • 3749
                • 24,544 Posts
                Quote from: splittingred at Mar 04, 2009, 11:19 PM

                Quote from: BobRay at Mar 04, 2009, 10:49 PM

                Under what circumstances would you want to have a document that contained nothing but JS or CSS, for example.
                If you wanted to provide a dynamic, snippet-driven javascript (say, JSON data), or dynamic CSS.

                The MODx Package Management in Revo connects to Providers that a Resources with a .js content type, and a snippet call in them to generate the JSON.
                OK, I think I get it. I’m seriously considering "this issue is beyond the scope of this book." wink
                Is it at all likely that a typical user would ever use any setting other than HTML?



                I’ve already used documents to hold straight text without changing the content type and it worked fine.
                Some browsers (safari) don’t like this, and throw warnings.
                I’m confused, but not *that* confused. I’d never deliver straight text to a browser. I meant I had stored straight text in a Doc and parsed it in a snippet in another Doc (e.g. EZfaq and, in the old days, SPForm). wink
                  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
                  • 30223
                  • 1,010 Posts
                  Quote from: BobRay at Mar 04, 2009, 10:49 PM

                  Ok, that gets me a closer, but I still don’t see what that setting actually does or what an end user might do with it.

                  Under what circumstances would you want to have a document that contained nothing but JS or CSS, for example.

                  I’ve already used documents to hold straight text without changing the content type and it worked fine.

                  I’ve used this on occasion for stylesheets. It’s a very simple way of delivering stylesheets where I wanted modx tags to be parsed without having to embed the styles in the document itself .

                  Is it at all likely that a typical user would ever use any setting other than HTML?
                  It is indeed.
                    • 25663 MODX Staff
                    • 12,272 Posts
                    I think you’ll see more and more developers wanting dynamic CSS at the minimum. It makes a lot of sense and is very easy to do things that way using CSS as a document. In fact, the new MODx site itself used this for quite a while during development. It’s also a great way to trigger downloads of CSV files produced as a report with an attachment disposition and an application/ms-excel and your report magically opens in Excel.
                      Ryan Thrash, MODX Co-Founder
                      Follow me on Twitter at @rthrash or catch my occasional unofficial thoughts at thrash.me
                      • 3749
                      • 24,544 Posts
                      Quote from: TobyL at Mar 05, 2009, 05:17 AM

                      I’ve used this on occasion for stylesheets. It’s a very simple way of delivering stylesheets where I wanted modx tags to be parsed without having to embed the styles in the document itself .

                      Can you describe that process in more detail for me. I think I understand, but I’m not sure.
                        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