+ if (isset($_POST['~always_field~'])) {
+ return ~file_name~_main_form();
+ }
+
+ # default action:
+ return ~file_name~_main_listing();~}~~opt_listing unset {~
+ return ~file_name~_main_form();~}~
+}~opt_display {~
+
+function ~file_name~_main_display($id) {
+ $data = db_get_assoc('~table_name~', 'id,'.~file_name upper~_DB_FIELDS, 'where id=%i', $id);
+ if (!$data) {
+ message("Error: Broken Link (~singular cap~ #$id not found)");~opt_public_something {~
+ return './' . $GLOBALS['wfpl_basename'];~}~~opt_public_something unset {~
+ return './~file_name~';~}~
+ }
+ tem_set('display', $data);
+}~}~~opt_db {~
+
+function ~file_name~_main_delete($id) {
+ db_delete('~table_name~', 'where id=%i', $id);
+ message('~singular cap~ deleted.');
+ return './~file_name~';
+}~}~~opt_listing {~
+
+function ~file_name~_csv_download() {
+ require_once(__DIR__.'/'.'inc/wfpl/csv.php');
+ $rows = db_get_rows('~table_name~', 'id,'.~file_name upper~_DB_FIELDS, 'order by id');
+ $fields = explode(',', 'id,'.~file_name upper~_DB_FIELDS);
+ $header = array();
+ foreach ($fields as $field) {
+ if (isset($GLOBALS['~file_name~_field_to_caption'][$field])) {
+ $header[] = $GLOBALS['~file_name~_field_to_caption'][$field];
+ } else {
+ $header[] = $field;