function definitionsexportAction() { $this->checkVersion(); if (isset($_GET['go'])) { if ('CSV' == $_REQUEST['format']) { header(sprintf('Content-Disposition: attachment;filename="vaf-export-%s.csv"', time())); header('Content-Type: text/csv'); } else { header(sprintf('Content-Disposition: attachment;filename="vaf-export-%s.xml"', time())); header('Content-Type: text/xml'); } if ('CSV' == $_REQUEST['format']) { $stream = fopen("php://output", 'w'); $exporter = new Elite_Vafimporter_Model_VehiclesList_CSV_Export(); $exporter->export($stream); } else { $exporter = new Elite_Vafimporter_Model_VehiclesList_XML_Export(); echo $exporter->export(); } exit; } $this->loadLayout(); $this->_setActiveMenu('vaf/export'); $block = $this->getLayout()->createBlock('core/template', 'vafimporter/definitionsexport'); $block->setTemplate('vafimporter/definitions_export.phtml'); $this->_addContent($block); $this->renderLayout(); }
protected function cols() { $return = $this->col('sku'); $return .= $this->col('universal'); $return .= parent::cols(); $return .= $this->doCols(); return $return; }
<?php require_once 'config.php'; $stream = $stream = fopen("php://output", 'w'); $exporter = new Elite_Vafimporter_Model_VehiclesList_CSV_Export(); $exporter->export($stream);