1、在内容模型管理-》普通文章 里添加一个字段 副标题=====subheading==== 已经固化在发布表单中字段=====不需要分页符======单行文本
2、在/后台目录/templets/article_add.htm里的标题字段下面(约219行)添加如下代码: <tr> <td colspan="2"><table width="100%" border="0" cellspacing="0" cellpadding="0" style="margin-bottom:3px;"> <tr> <td width="90" class="bline" height='24'> 副 标 题:</td> <td class="bline"><input type='text' name='subheading' id='subheading' style='width:388px' class='intxt' value='' /></td> </tr> </table><input type='hidden' name='dede_addonfields' value="subheading,text"> </td> </tr>
同理在/后台目录/templets/article_edit.htm添加该字段(约218行)
<tr> <td colspan="2"><table width="100%" border="0" cellspacing="0" cellpadding="0" style="margin-bottom:3px;"> <tr> <td width="90" class="bline" height='24'> 副 标 题:</td> <td class="bline"><input type='text' name='subheading' id='subheading' style='width:388px' class='intxt' value='<?php echo $addRow['subheading']; ?>' /></td> </tr> </table><input type='hidden' name='dede_addonfields' value="subheading,text"> </td> </tr>
3、在/后台目录/article_add.php和article_edit.php中修改如下代码,否则会保存不到数据库 注:只添加,有背景色的字段。
1)article_add.php中216行 $useip = GetIP(); $templet = empty($templet) ? '' : $templet; $query = "INSERT INTO `{$addtable}`(aid,typeid,redirecturl,templet,userip,subheading,body{$inadd_f}) Values('$arcID','$typeid','$redirecturl','$templet','$useip','$subheading','$body'{$inadd_v})"; if(!$dsql->ExecuteNoneQuery($query))
2)article_edit.php中217行 if($addtable!='') { $useip = GetIP(); $templet = empty($templet) ? '' : $templet; $iquery = "UPDATE `$addtable` SET typeid='$typeid',body='$body'{$inadd_f},subheading='$subheading',redirecturl='$redirecturl',templet='$templet',userip='$useip' WHERE aid='$id'"; if(!$dsql->ExecuteNoneQuery($iquery)) { ShowMsg("更新附加表 `$addtable` 时出错,请检查原因!","javascript:;"); exit(); } }
3、在article_article.htm和article_default.htm两个前台模板文件中前台添加显示代码:
附加: 如果是系统自动生成表单字段,可在include/customfields.func.php里127行修改添加字段的样式 else { $dfvalue = ($ctag->GetAtt('default')!='' ? $ctag->GetAtt('default') : ''); $innertext = "<input type='text' name='$fieldname' id='$fieldname' style='width:388px' class='intxt' value='$dfvalue' />\r\n"; } $formitem = str_replace("~name~",$ctag->GetAtt('itemname'),$formitem); $formitem = str_replace("~form~",$innertext,$formitem); return $formitem;
|