On Apr 12, 2:51 pm, Melanie Sommer <[email protected]> wrote: > I want to have the output as plain text offered with a download > dialog. > > This works fine on my server with a .php file outside of cake that > looks like > <?php header("Content-Type: text/plain"); > header('Content-Disposition: attachment; filename="test.tex"'); > echo "aa\n\na\ta\ta?> > > In cake I create a new layout in views/layouts/tex.ctp > content: > <?php header("Content-Type: text/plain"); > header('Content-Disposition: attachment; filename="english.tex"'); > echo $content_for_layout; ?> > > in my controller I wrote > Configure::write('debug', '0'); > $this->render(null,'tex'); > > and in the view the content. > > But it does not work, cake uses the layout, but seems to ignore the > header command. Output is sent as text/html. > > Why -- and how can I change that.
Because the View class uses output buffering. Have a look at MediaView instead: http://book.cakephp.org/view/489/Media-Views http://api.cakephp.org/class/media-view http://cakedc.com/eng/florian_kraemer/2010/01/25/file-uploading-file-storage-and-cakephp-mediaview-class Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en To unsubscribe, reply using "remove me" as the subject.
