//批量生成模板 $autojump = "autopost();"; $page = intval($page); $rsdb = $db->get_one("SELECT * FROM {$_pre}module LIMIT {$page},1 "); $id = $rsdb[id]; if (!$id) { jump("模板生成完毕", "{$admin_path}&job=list", 3); } $page++; } else { $rsdb = $db->get_one("SELECT * FROM {$_pre}module WHERE id='{$id}' "); } $array = unserialize($rsdb[config]); $tpl_L1 = $tpl_L2 = $tpl_sarch2 = $tpl_sarch1 = ''; foreach ($array[field_db] as $key => $rs) { $tpl_p .= make_post_table($rs); $tpl_s .= make_show_table($rs); if ($array[search_db][$key]) { if ($rs[form_type] == "select" || $rs[form_type] == "radio" || $rs[form_type] == "checkbox") { $show = make_search_table($rs); $tpl_sarch2 .= "<tr><td>{$rs[title]}:</td><td>{$show}</td></tr>"; } else { $tpl_sarch1 .= make_search_table($rs); } } if ($array[listshow_db][$key]) { $tpl_L1 .= "<td align='center'>{$rs[title]}</td>"; $tpl_L2 .= "<td align='center'>\$rs[{$rs[field_name]}] {$rs[form_units]}</td>"; } } //前台列表页模板
$search_tpl = read_file($search_tpl_file); //列表页 if (is_file(ROOT_PATH . "{$tpldb['list']}")) { $list_tpl_file = ROOT_PATH . "{$tpldb['list']}"; $list_tpl = read_file($list_tpl_file); } else { $list_tpl = ''; } $Temp_list = ''; $array = unserialize($rsdb[config]); $i = 0; foreach ($array[field_db] as $key => $rs) { $i++; $styleclass = $i % 2 == 0 ? ' b2' : ' b1'; $tpl_p .= make_post_table($rs, $member_post_tpl); $admin_post_tpl .= make_post_table($rs, $post_tpl); $tpl_s .= make_show_table($rs, $styleclass, $show_tpl); if ($array[search_db][$key]) { if ($rs[form_type] == "select" || $rs[form_type] == "radio" || $rs[form_type] == "checkbox") { $show = make_search_table($rs); $tpl_sarch2 .= "<tr><td align='left'>{$rs[title]}:</td><td align='left'>{$show}</td></tr>"; } else { $tpl_sarch1 .= make_search_table($rs); } } if ($array[IfListShow][$key]) { $Temp_list .= "<span class='b'>{$rs[title]}</span> "; $Temp_list .= "<span class='a'>{\$rs[{$key}]}</span> "; } } /*
function member_field($array) { $post_tpl = "<!--\r\n<?php\r\nprint <<<EOT\r\n--> \r\n<table width=\"100%\" border=\"0\" cellspacing=\"3\" cellpadding=\"3\"><tr><td width='28%'></td><td width='72%'></td></tr>"; $show_tpl = "<!--\r\n<?php\r\nprint <<<EOT\r\n--> \r\n<table width=\"100%\" border=\"0\" cellspacing=\"3\" cellpadding=\"3\">"; foreach ($array as $key => $rs) { if ($rs[mustfill]) { $namedb[] = filtrate($rs[title]); $iddb[] = "atc_{$rs[field_name]}"; } $post_tpl .= make_post_table($rs); $show_tpl .= "<tr> <td style='border-bottom:1px dotted #ccc;'>{$rs[title]}:</td> <td style='border-bottom:1px dotted #ccc;'>{\$rsdb[{$rs[field_name]}]} {$rs[form_units]} </td></tr>"; } if ($namedb) { $_name = implode(",", $namedb); $_id = implode(",", $iddb); $post_tpl = str_replace("<table", "<table onmouseover=\"ckregdata('{$_id}','{$_name}');\"", $post_tpl); } $post_tpl .= "</table>\r\n<!--\r\nEOT;\r\n?>-->"; $show_tpl .= "</table>\r\n<!--\r\nEOT;\r\n?>-->"; write_file(ROOT_PATH . "template/default/regfield_show.htm", $show_tpl); write_file(ROOT_PATH . "template/default/regfield.htm", $post_tpl); }