+ $tem->set('name', $name);
+ $tem->set('caption', format_caption($name));
+ $tem->show($input);
+ if($input != 'hidden') {
+ $tem->show('row');
+ }
+
+ if($input == 'image' && !$uploads_output_already) {
+ $tem->show('uploads');
+ $tem->set('enctype_attr', '" enctype="multipart/form-data');
+ $uploads_output_already = true;
+ } elseif($input == 'html') {
+ $has_html_editors = true;
+ $tem->set('html_field_name', $name);
+ $tem->show('replace_textarea');
+ }
+
+ if($GLOBALS['opt_display'] == 'Yes') {
+ switch($input) {
+ case 'image':
+ $tem->show('display_image');
+ break;
+ case 'checkbox':
+ case 'leftcheck':
+ $tem->show('display_yesno');
+ break;
+ case 'date':
+ $tem->show('display_date');
+ break;
+ case 'textarea':
+ $tem->show('display_multiline');
+ break;
+ case 'html':
+ $tem->show('display_html');
+ break;
+ default:
+ $tem->show('display_short');
+ }
+ $tem->show('display_row');
+ }
+
+ if($GLOBALS['opt_listing'] == 'Yes') {
+ if($GLOBALS['opt_display'] != 'Yes') {
+ $tem->show('opt_display_a_else');
+ }
+ if(show_in_listing($type, $input, $format, $sql)) {
+ if($format == 'bool' || $format == 'yesno') {
+ $tem->set('listing_enc', 'yesno');
+ $tem->show('listing_value_enc');
+ } elseif($input == 'date') {
+ $tem->set('listing_enc', 'mmddyyyy');
+ $tem->show('listing_value_enc');
+ } elseif($type == 'thumb') {
+ $tem->show('listing_value_thumb');
+ } else {
+ $tem->set('listing_enc', 'html');
+ $tem->show('listing_value_enc');
+ }
+ $tem->show('listing_head_col');
+ $tem->show('listing_row_col');
+ }
+ }
+ }
+
+ if($GLOBALS['opt_db'] == 'Yes') {
+ $tem->show('opt_db_1');
+ $tem->show('opt_db_2');
+ } else {
+ $tem->show('opt_db_1_else');
+ }
+
+ if($GLOBALS['opt_listing'] == 'Yes') {
+ $tem->show('opt_listing_1');
+ }
+
+ if($GLOBALS['opt_display'] == 'Yes') {
+ $tem->show('opt_display_1');
+ $tem->show('opt_display_2');
+ }
+
+ if($GLOBALS['opt_email'] == 'Yes' && $GLOBALS['opt_db'] != 'Yes') {
+ $tem->set('name', 'send');
+ $tem->set('caption', 'Send');
+ } else {
+ $tem->set('name', 'save');
+ $tem->set('caption', 'Save');
+ }
+ $tem->show('submit');
+ $tem->show('row');
+
+ $tem->show('form');
+
+ if($has_html_editors) {
+ $tem->show('html_editor_headers');
+ }
+
+ if($whole_file) {
+ return $tem->run();
+ } else {
+ return $tem->get('form');
+ }
+}
+
+function view_html() {
+ view_headers();
+ echo make_html();