分享

添加副标题字段_添加新字段_织梦文章管理系统

 顾于思文摘馆 2017-06-18
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两个前台模板文件中前台添加显示代码:

{dede:field.subheading/}





附加:
如果是系统自动生成表单字段,可在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;




    本站是提供个人知识管理的网络存储空间,所有内容均由用户发布,不代表本站观点。请注意甄别内容中的联系方式、诱导购买等信息,谨防诈骗。如发现有害或侵权内容,请点击一键举报。
    转藏 分享 献花(0

    0条评论

    发表

    请遵守用户 评论公约

    类似文章 更多