$this->autoRender = false

but you could use a plain layout (i call it "ajax")
and echo it in the view
this way you would do it "right"

you can also use the Media view which would set the headers for you.


but if this quick and dirty approach of yours works for you, why not



On 26 Okt., 14:19, psybear83 <[email protected]> wrote:
> Hi everybody
>
> I want to give my users the possibility to download the content of the
> model IniFile's field "text" as plain text.
>
> I came up with the following solution:
>
>   function exportIniFile() {
>     $iniFile = $this->IniFile->find($this->params['named']['id']);
>     header("Content-type: text/plain");
>     header("Content-Disposition: attachment; filename=
> \"{$iniFile['IniFile']['user_name']}.ini\"");
>     echo $iniFile['IniFile']['text'];
>     die;
>   }
>
> This works, but I suspect that it's not the very best solution,
> because I have to use a die() statement to break code execution,
> because otherwise the layout and stuff would be appended to the
> IniFile's text. Is there a better way? I tried $this->layout = false,
> but this didn't work...
>
> Thanks a lot
> Josh

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

Reply via email to