-
Notifications
You must be signed in to change notification settings - Fork 0
Export
mtwebit edited this page Oct 5, 2022
·
7 revisions
It is possible to export data from PW pages in CSV format.
The module provides a CSV renderer that can be used in your template, e.g.:
header("Content-type: text/csv");
echo wire('modules')->DataSetRenderer->renderCSV($page);
exit();
The "global config" section of the dataset page may specify export rules in the following form:
pages:
template: Template_name_of_data_pages
export:
fields: [ field_name1, field_name2, ... ]
delimiter: ';'
header: 1
If the field is a page reference then you can specify what field of the referenced page will be exported:
page_ref_field: field_name
pages:
template: Event_Marriage
export:
fields: [ marriage_id, husband_ref_by_id: person_id, wife_ref_by_id: person_id, place_ref_by_id: title, datetime, datetime_accuracy, source_text ]
delimiter: ';'
header: 1