I have a CakePHP controller action where I would like to let the user download an HTML page for publishing through our internal CMS. I'm thinking that the notion of a Media View is what I want, except that they seem to require a filename and path. I already have the HTML content stored in a string and if possible I would like to be able to avoid saving it to disk just to make this work. Does anybody know a way of passing the content to Media Views as a string rather than as a filename and path?
A:
Looking at the source code of media.php
, it seems that you can't do this directly using that view. Unless anybody has a better idea, I'm tempted to modify the view to support a content
parameter.
andygeers
2009-06-04 11:15:03
A:
Check out this thread from the Google group. http://groups.google.com/group/cake-php/browse_thread/thread/9e99a7b99b54017d/bbaa1d6fd46cf299?hl=en&lnk=gst&q=mediaview#
There are instructions and patch that on how to create your own media view that handles this.
Matt Curry
2009-06-04 13:18:26
Not entirely sure that's what I want, in that it still saves a temporary file (which seems overkill to me). I patched media.php to just output the content directly.
andygeers
2009-06-04 13:47:50