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
    I assume that this is for storing content in files rather than the DB. So two questions:

    1. Will this be working in 2.0?

    2. Why are the choices called "Inline" and "Attachment" rather than Database and File?
      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
      Actually, the content disposition settings signify whether a MODx page should be displayed in the browser or whether it should trigger a download when requested. Inline displays content in the browser and attachments can be used to prompt a download.

      For example, I’ve used it recently to have a MODx page generate a dynamic PDF and, on calling the page, the PDF is triggered as a download.
        Garry Nutting
        Senior Developer
        MODX, LLC

        Email: [email protected]
        Twitter: @garryn
        Web: modx.com
        • 3749
        • 24,544 Posts
        Quote from: garryn at Mar 04, 2009, 03:33 AM

        Actually, the content disposition settings signify whether a MODx page should be displayed in the browser or whether it should trigger a download when requested. Inline displays content in the browser and attachments can be used to prompt a download.

        For example, I’ve used it recently to have a MODx page generate a dynamic PDF and, on calling the page, the PDF is triggered as a download.

        Thanks, I obviously had it confused. The term content disposition is somewhat misleading, IMO and maybe "attachment" could better be called "download."

          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:33 PM

          Thanks, I obviously had it confused. The term content disposition is somewhat misleading, IMO and maybe "attachment" could better be called "download."
          These are the real HTTP header values for Content-Disposition, so we risk confusing those familiar with such standards if we use different terminology. I’m not a fan of making up new semantics in the product for things that are already well established, but this is also where using Lexicons can allow you to customize how these things are referred to in the manager interface based on your user needs.
            • 3749
            • 24,544 Posts
            Fair enough -- I think I once knew these as HTTP header terms but had forgotton. I’d say those names are completely defensible. We’ll just have to explain it well.


            Is there a way to make the page content hold a .PDF, .zip, or .doc file without creating it in code? Will file_get_contents() in a snippet do it? Is there an easier way?


              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, 10:53 PM

              Is there a way to make the page content hold a .PDF, .zip, or .doc file without creating it in code? Will file_get_contents() in a snippet do it? Is there an easier way?
              When you create a content type, you can supply the extension that will be appended to the alias when generated in the cache and into the pages by makeUrl(). The exception is if your resource is marked as a container, which will automatically get the config setting for container_suffix appended to it (’/’ by default).
                • 3749
                • 24,544 Posts
                Ok, it all makes sense, except that I can’t save a Static Resource with a Content disposition of "attachment." On save, it switches back to "inline."

                  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 05, 2009, 06:53 PM

                  Ok, it all makes sense, except that I can’t save a Static Resource with a Content disposition of "attachment." On save, it switches back to "inline."
                  I think it’s a UI bug; the value is being set...
                    • 3749
                    • 24,544 Posts
                    Quote from: OpenGeek at Mar 05, 2009, 07:08 PM

                    Quote from: BobRay at Mar 05, 2009, 06:53 PM

                    Ok, it all makes sense, except that I can’t save a Static Resource with a Content disposition of "attachment." On save, it switches back to "inline."
                    I think it’s a UI bug; the value is being set...

                    Not for me. The content_dispo field stays at 0 in the DB, although content_type is set correctly.

                    If I change it manually in the DB, I do get the download dialog, but if I then save the SR again without touching the content-dispo field, it reverts to inline.

                    I put this in Jira.

                    BTW, with content_dispo at 0, access to the document launches Adobe Reader but Adobe give me an "insufficient data for an image" error, even though when I double-click on the file itself, Adobe has no problem with it. Possibly MODx isn’t setting the header correctly (please tell me it’s not a character encoding issue :’( ). If I save the file in FF, the saved file is 23 bytes shorter than the original and gives the same error when I try to view it with Adobe Reader.
                      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 05, 2009, 10:49 PM

                      BTW, with content_dispo at 0, access to the document launches Adobe Reader but Adobe give me an "insufficient data for an image" error, even though when I double-click on the file itself, Adobe has no problem with it. Possibly MODx isn’t setting the header correctly (please tell me it’s not a character encoding issue :’( ). If I save the file in FF, the saved file is 23 bytes shorter than the original and gives the same error when I try to view it with Adobe Reader.
                      Did you make sure not to enable output compression in your .htaccess? That will cause problems. Otherwise, it could very well be a header issue, or you might have extra whitespace in a PHP file somewhere that is getting echo’d into the output.