views:

14

answers:

1

Hi, I am basically trying to export from ZEND to csv as described http://stackoverflow.com/questions/1136264/export-csv-in-zend-framework

and use the $this->_helper->viewRenderer->setNeverRender(); unfortunately the plugin code is still contained in the csv file. Any clue why?

 public function indexAction()  {

    $this->_helper->layout()->disableLayout();
    $this->_helper->viewRenderer->setNeverRender();
    $filename = "Test".'-'.date('Ymd').'.csv';

    header("Content-type: text/csv; charset=UTF-8; header=present");
    header('Content-Disposition: attachment; filename="'.$filename.'"');
    header("Content-Transfer-Encoding: binary");
    header("Pragma: no-cache");
    header("Expires: 0");

    mb_internal_encoding("UTF-8");
    mb_http_output("UTF-8");

    //foreach ($data as $record) {
        echo chr(13).chr(10);
        //echo '<br>';
        echo 'AMB-'.'1;';
        echo chr(13).chr(10);
        //echo '<br>';
        echo 'AMB-'.'1;';

    }
A: 

I believe the method is called "setNoRender()"...

QuickNDirty solution (as I see you don't use view) is to "die()" after all the echoing is finished :P

Tomáš Fejfar