NAVIGATION
This shows you the differences between two versions of the page.
|
english:other-enhancements:hacks:form-result-download-csv [2012/05/18 10:35] Knut Heermann (flip-flop) |
english:other-enhancements:hacks:form-result-download-csv [2018/06/03 18:09] (current) |
||
|---|---|---|---|
| Line 60: | Line 60: | ||
| **Update V1.1 18.05.2012:** A standard CSV output even if " and/or a field separator in the cell text, \\ | **Update V1.1 18.05.2012:** A standard CSV output even if " and/or a field separator in the cell text, \\ | ||
| see [[http://forum.phpwcms.org/viewtopic.php?p=135720#p135720]]. | see [[http://forum.phpwcms.org/viewtopic.php?p=135720#p135720]]. | ||
| - | |||
| - | Als Feldtrenner wird hier ein ##**;**## verwendet, einstellbar in der Variablen **$separator**, etwa in Zeile 140. | ||
| As a field separator the sign ##**;**## is in use, which is adjustable in the variable **$separator** around line 140. | As a field separator the sign ##**;**## is in use, which is adjustable in the variable **$separator** around line 140. | ||
| Line 94: | Line 92: | ||
| $export = array(); | $export = array(); | ||
| $row = 1; | $row = 1; | ||
| - | $export[0] = array('#ID'=>'','#Date'=>'','#IP'=>''); | + | $export[0] = array('#'=>'','#ID'=>'','#Date'=>'','#IP'=>''); |
| // run all data first and combine array elements | // run all data first and combine array elements | ||
| Line 100: | Line 98: | ||
| // numbering starting at 1 | // numbering starting at 1 | ||
| + | $export[$row]['#'] = $row; | ||
| $export[$row]['#ID'] = $value['formresult_id']; | $export[$row]['#ID'] = $value['formresult_id']; | ||
| $export[$row]['#Date'] = $value['formresult_createdate']; | $export[$row]['#Date'] = $value['formresult_createdate']; | ||
| Line 145: | Line 144: | ||
| $elements[$x] .= ''; | $elements[$x] .= ''; | ||
| - | if ( isset($export[$x][$key]) ) { | + | // if ( isset($export[$x][$key]) ) { |
| // // Nicht zwingen notwenig, nur um fuer HTML-Darstellung | // // Nicht zwingen notwenig, nur um fuer HTML-Darstellung | ||
| Line 154: | Line 153: | ||
| $export[$x][$key] = '"'.str_replace('"', '""', $export[$x][$key]).'"'; // Jede Spalte in "..." setzen | $export[$x][$key] = '"'.str_replace('"', '""', $export[$x][$key]).'"'; // Jede Spalte in "..." setzen | ||
| - | } | + | // } |
| $elements[$x] .= $separator; // CSV-Trenner setzen | $elements[$x] .= $separator; // CSV-Trenner setzen | ||