<?php CrudGenUtility::createTemplatesPathIfNotExists($template_path); $fp = fopen($Settings->settings['TemplatesWriteablePath'] . $template_path, 'w'); # Datalist Content # $fp1 = fopen(LIBS_PATH . "/templates/editform.tpl", 'r'); $content = fread($fp1, filesize(LIBS_PATH . "/templates/editform.tpl")); fclose($fp1); # Datalist Content # $fp2 = fopen(LIBS_PATH . "/templates/editform_fields.tpl", 'r'); $fields_content = fread($fp2, filesize(LIBS_PATH . "/templates/editform_fields.tpl")); fclose($fp2); $s_word = "s"; $content = str_replace("##KeyLabel##", $keyLabel, $content); $content = str_replace("##KeyLabel-PHP##", '{$' . $keyLabel . '}', $content); $content = str_replace("##ItemLabel##", $itemLabel, $content); $content = str_replace("##s_word##", $s_word, $content); $content = str_replace("##datalistLink", $src_path, $content); $content = str_replace("##formAction", $editform_action, $content); $fields_content_str = ""; foreach ($includeArr as $key => $value) { $get_fields_content = $fields_content; $fieldKey = CrudGenUtility::getField($key); $get_fields_content = str_replace("##FieldKey##", $fieldKey, $get_fields_content); $get_fields_content = str_replace("##Key##", $key, $get_fields_content); $get_fields_content = str_replace("##MemberKey-PHP##", '{$' . $Key . '}', $get_fields_content); $fields_content_str .= $get_fields_content; } $content = str_replace("##FieldInputs##", $fields_content_str, $content); fwrite($fp, $content); fclose($fp);
<?php CrudGenUtility::createTemplatesPathIfNotExists($editTemplatePath); $fp = fopen($Settings->settings['TemplatesWriteablePath'] . $editTemplatePath, 'w'); # Datalist Content # $fp1 = fopen(LIBS_PATH . "/templates/editform.tpl", 'r'); $content = fread($fp1, filesize(LIBS_PATH . "/templates/editform.tpl")); fclose($fp1); # Datalist Content # $fp2 = fopen(LIBS_PATH . "/templates/editform_fields.tpl", 'r'); $fields_content = fread($fp2, filesize(LIBS_PATH . "/templates/editform_fields.tpl")); fclose($fp2); # Datalist Content # $fp15 = fopen(LIBS_PATH . "/templates/editform_fields_text.tpl", 'r'); $fields_content_text = fread($fp15, filesize(LIBS_PATH . "/templates/editform_fields_text.tpl")); fclose($fp15); $fp16 = fopen(LIBS_PATH . "/templates/editform_fields_yesno.tpl", 'r'); $fields_content_yesno = fread($fp16, filesize(LIBS_PATH . "/templates/editform_fields_yesno.tpl")); fclose($fp16); $add_s = "s"; $content = str_replace("##Header-Inc##", "{include file='header.tpl'}", $content); $content = str_replace("##UserBar-Inc##", "{include file='user_bar.tpl'}", $content); $content = str_replace("##Footer-Inc##", "{include file='footer.tpl'}", $content); $content = str_replace("##Datalist-Link##", str_replace(".php", "", $src_path), $content); $content = str_replace("##SITE_ROOT##", SITE_ROOT, $content); $content = str_replace("##Item-Label##", $itemLabel, $content); $content = str_replace("##Item-Label-s##", $itemLabel . $add_s, $content); $content = str_replace("##Save-Path##", str_replace(".php", "", $save_path), $content); $content = str_replace("##KeyLabel##", $keyLabel, $content); $content = str_replace("##KeyLabel-php##", '{$' . $keyLabel . '}', $content); $hidden_varspass_fields = "";