Hi Smith,

u can set your content type by

$response->setContentType('text/csv');
//$response->setContentType('text/x-csv');
//$response->setContentType('application/csv');
$response->setHttpHeader('Content-Disposition', 'attachment; filename=' .
$file_name);

On Tue, Mar 31, 2009 at 5:16 PM, cokker <[email protected]> wrote:

>
> try to return SfView::NONE
>
> or disable layout in module/view.yml
>
> greets
> Sven
>
> Mark Smith schrieb:
> > Hi,
> >
> > I am trying to add an action that just returns a report as raw CSV
> > data.
> >
> > Is it possible to bypass the template layer and just set my own
> > content?
> >
> > My code looks like this so far:
> >
> >   public function execute($request)
> >   {
> >     $response = $this->getResponse();
> >     $manager=new ReportManager();
> >     $response->setContent($manager->getReport());
> >     $response->sendContent();
> >   }
> >
> > The CSV data gets written out perfectly, but then so does my layout
> > and template.
> >
> > Is it possible to stop this? And also set the mime type?
> >
> > Thanks for any help.
> > >
>
>
> >
>


-- 
Regards,
Dheeraj

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"symfony users" 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/symfony-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to