Re: media view and files on the fly
Sorry, forgot to mention: you also need to tell it to use that view renderer. In your action: $this->view = 'AppMedia'; Although the way you have it works too, the only thing you lose is the ability to access the original MediaView, which isn't a big deal since this one does all the same things. -Matt http://www.pseudocoder.com On Mar 31, 5:15 pm, "Mark (Germany)" wrote: > are you sure it is app_media.php then? > i only got it to work by leaving it the same name "media.php" in /app/ > views/ > > mark > > On 31 Mrz., 21:45, "Mark (Germany)" > wrote: > > > nice :) > > thx > > > On 31 Mrz., 15:17, Matt Curry wrote: > > > > I had to do this with pdf/xls files returned by a webservice. I took > > > the default media view (/cake/libs/views/media.php) and copied it to / > > > app/views/app_media.php. > > > > Then I modified it so that it checked for a $content view var and > > > wrote that to a tmpfile. > > > Here's the diff:http://bin.cakephp.org/view/1310700342 > > > > -Matthttp://www.pseudocoder.com > > > > On Mar 30, 1:05 pm, "Mark (Germany)" > > > wrote: > > > > > i tried to use the media view for files generated on thefly(some > > > > exported text inside a export.txt or whatever) > > > > but it seems like the media view can only handle downloads of > > > > "existing" files on the server > > > > > trying to rewrite it did not turn out very well > > > > so, did anyone manage to create a txt file to download, that is filled > > > > with the echoed content > > > > > echo 'blabla' > > > > or > > > > $content = 'blabla' transfered to the media view > > > > > without creating locale (temp.) files on the server? > > --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: media view and files on the fly
are you sure it is app_media.php then? i only got it to work by leaving it the same name "media.php" in /app/ views/ mark On 31 Mrz., 21:45, "Mark (Germany)" wrote: > nice :) > thx > > On 31 Mrz., 15:17, Matt Curry wrote: > > > I had to do this with pdf/xls files returned by a webservice. I took > > the default media view (/cake/libs/views/media.php) and copied it to / > > app/views/app_media.php. > > > Then I modified it so that it checked for a $content view var and > > wrote that to a tmpfile. > > Here's the diff:http://bin.cakephp.org/view/1310700342 > > > -Matthttp://www.pseudocoder.com > > > On Mar 30, 1:05 pm, "Mark (Germany)" > > wrote: > > > > i tried to use the media view for files generated on thefly(some > > > exported text inside a export.txt or whatever) > > > but it seems like the media view can only handle downloads of > > > "existing" files on the server > > > > trying to rewrite it did not turn out very well > > > so, did anyone manage to create a txt file to download, that is filled > > > with the echoed content > > > > echo 'blabla' > > > or > > > $content = 'blabla' transfered to the media view > > > > without creating locale (temp.) files on the server? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: media view and files on the fly
nice :) thx On 31 Mrz., 15:17, Matt Curry wrote: > I had to do this with pdf/xls files returned by a webservice. I took > the default media view (/cake/libs/views/media.php) and copied it to / > app/views/app_media.php. > > Then I modified it so that it checked for a $content view var and > wrote that to a tmpfile. > Here's the diff:http://bin.cakephp.org/view/1310700342 > > -Matthttp://www.pseudocoder.com > > On Mar 30, 1:05 pm, "Mark (Germany)" > wrote: > > > i tried to use the media view for files generated on the fly (some > > exported text inside a export.txt or whatever) > > but it seems like the media view can only handle downloads of > > "existing" files on the server > > > trying to rewrite it did not turn out very well > > so, did anyone manage to create a txt file to download, that is filled > > with the echoed content > > > echo 'blabla' > > or > > $content = 'blabla' transfered to the media view > > > without creating locale (temp.) files on the server? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: media view and files on the fly
I had to do this with pdf/xls files returned by a webservice. I took the default media view (/cake/libs/views/media.php) and copied it to / app/views/app_media.php. Then I modified it so that it checked for a $content view var and wrote that to a tmpfile. Here's the diff: http://bin.cakephp.org/view/1310700342 -Matt http://www.pseudocoder.com On Mar 30, 1:05 pm, "Mark (Germany)" wrote: > i tried to use the media view for files generated on the fly (some > exported text inside a export.txt or whatever) > but it seems like the media view can only handle downloads of > "existing" files on the server > > trying to rewrite it did not turn out very well > so, did anyone manage to create a txt file to download, that is filled > with the echoed content > > echo 'blabla' > or > $content = 'blabla' transfered to the media view > > without creating locale (temp.) files on the server? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: media view and files on the fly
I have so far lest MediaView alone and gone a different way for "fake", dynamic, files. I have made use of parseExtensions to output files. The examples mostly show rss feeds but you can just as easily use it to generate an Excel sheet full of statistics about something on your site or any other dynamic output. /Martin On Mar 30, 7:05 pm, "Mark (Germany)" wrote: > i tried to use the media view for files generated on the fly (some > exported text inside a export.txt or whatever) > but it seems like the media view can only handle downloads of > "existing" files on the server > > trying to rewrite it did not turn out very well > so, did anyone manage to create a txt file to download, that is filled > with the echoed content > > echo 'blabla' > or > $content = 'blabla' transfered to the media view > > without creating locale (temp.) files on the server? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
media view and files on the fly
i tried to use the media view for files generated on the fly (some exported text inside a export.txt or whatever) but it seems like the media view can only handle downloads of "existing" files on the server trying to rewrite it did not turn out very well so, did anyone manage to create a txt file to download, that is filled with the echoed content echo 'blabla' or $content = 'blabla' transfered to the media view without creating locale (temp.) files on the server? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---