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.
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.
Thanks, I obviously had it confused. The term content disposition is somewhat misleading, IMO and maybe "attachment" could better be called "download."
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).
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?
I think it’s a UI bug; the value is being set...
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."
Quote from: BobRay at Mar 05, 2009, 06:53 PMI think it’s a UI bug; the value is being set...
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 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.
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.