Skip to content
Nicholas K. Dionysopoulos edited this page Feb 12, 2015 · 1 revision

The Csv view class FOF30\View\DataView\Csv is designed to create data-aware Views which result in downloadable CSV files.

CSV files are a standard and very convenient way of exporting data for use in third party applications and systems such as Microsoft Office Excel, OpenOffice / LibreOffice Calc or even import data in third party databases.

This View class is simply an extension to the Raw view class. Everything described in the Raw view class still applies here. The Csv class adds a few features on top of what Raw can already do.

The $config configuration array to the class can contain the following parameters:

  • csv_header Should I add a CSV header (list of fields)? Default true. You can also pass the URL parameter csv_header=1 and csv_header=0 to toggle this.
  • csv_filename The filename which will appear in the browser's Save As dialog box. Defaults to the name of the view. You can also pass it in the URL parameter csv_filename=something.csv
  • csv_fields An array of fields which should be included in the CSV output. Leave it empty to include all fields known to the DataModel.

The generated CSV is in a format compatible with Microsoft Office Excel, supported by virtually every other software which claims CSV compatibility.

Clone this wiki locally