Dans ma méthode d'initialisation du contrôleur j'ai cettecomment puis-je mettre en place un contextSwitch pour générer un fichier csv
public function init()
{
//initialise the context switch action helper
$this->_helper->getHelper('contextSwitch')
->addContext('csv', array('suffix' => 'csv',
'headers' => array(
'Context-Type' => 'application/csv',
'Context-Disposition' => 'inline; filename="fooo.csv"',
'Pragma' => 'no-cache',
'Expires' => '0',
)))
->addActionContext('stockreport', 'csv')
->initContext();
}
Dans mon stockreportAction j'ai désactivé la mise en page et afficher rendu comme suit.
public function stockreportAction()
{
$this->_helper->layout->disableLayout();
$this->_helper->viewRenderer->setNoRender();
echo 'foobar';
}
je reçois une page blanche quand je l'appelle ce dossier, je voudrais générer ce donc dans l'exemple « toto » apparaît sous la forme d'un fichier csv téléchargeable. Quelqu'un peut-il conseiller
est-Zend_Smug encore disponibles? – user466764