<?php include "./content/side.php"; ?> <div class="big-col"> <div class="banner"> <a href=""><img src="./img/site/banner2.png" alt="MitraCollection.com" title="MitraCollection.com"></a> </div> <div class="produk-title"> <?php @($key = $_POST['key']); ?> <h1>Hasil Pencarian dengan keyword : <?php echo $key; ?> </h1> </div> <div class="list-p"> <?php if ($key == "") { echo "<div class=error>Kata kunci tidak terkait dengan data di website ini</div>"; } else { find_search(); } ?> </div> </div> </div> <!--end container !--> </div>
/** * Export controller, generates CSV. * * @param string $key */ function find_export_csv($key) { $output = find_search($key); header('Content-Type: text/csv'); header('Content-Disposition: attachment; filename="naturwerk-' . $output['search']['#key'] . '.csv"'); $out = fopen('php://output', 'w'); $writer = new Csv_Writer($out, new Csv_Dialect_Excel()); $current = $output['search']['#current']; $result = $current->search(); // build header row $data = array(); foreach ($current->getActiveColumns() as $column) { $data[] = $column->getTitle(); } $writer->writeRow($data); foreach ($result as $row) { // convert to ISO-8859-1 for Excel $data = array(); foreach ($current->getActiveColumns() as $column) { $data[] = utf8_decode($row->__get($column->getName())); } $writer->writeRow($data); } }