一般情况下,大家可以在网站内容模型管理界面下添加自定义模型的字段,如果你想添加默认的文章模型字段,就是在p8_article数据表中,并给予后台设置和前台调用的话,就需要参考本帖。下面关键词用红色标注。
1.先在数据表p8_article中添加新的数据字段,留意自己安装时设置的表区分符,默认是p8_
VARCHAR(100中这个100是指字节长度,可以加大比如1000.
ALTER TABLE `p8_article` ADD `diy001` VARCHAR( 100 ) NOT NULL ;
编辑admin\template\post\post.htm:在
<input type="checkbox" name="postdb[target]" value="1" $target>
新窗口打开 $baseSpecial</td>
</tr>
下添加:
<tr bgcolor="#FFFFFF" class="basetr">
<td class="tdL">自定义001:</td>
<td class="tdR">
<input type="text" name="postdb[diy001]" size="60" value="$rsdb[diy001]">
</td>
</tr>
编辑根目录下inc\artic_function.php:把
$db->query("
INSERT INTO `{$pre}article$erp`
( `title`, `smalltitle`, `fid`,`fname`, `hits`, `pages`, `posttime`, `list`, `uid`, `username`, `author`, `copyfrom`, `copyfromurl`, `titlecolor`, `fonttype`, `picurl`, `ispic`, `yz`, `yzer`, `yztime`, `keywords`, `jumpurl`, `iframeurl`, `style`, `template`, `target`,`ip`, `lastfid`, `money`, `passwd`, `editer`, `edittime`, `begintime`, `endtime`, `description`, `levels`,allowdown,allowview,mid,htmlname,forbidcomment)
VALUES
('$postdb[title]','$postdb[smalltitle]','$fid','$fidDB[name]','$postdb[hits]','1','$postdb[posttime]','$postdb
','$lfjdb[uid]','$lfjdb[username]','$postdb[author]','$postdb[copyfrom]','$postdb[copyfromurl]','$postdb[titlecolor]','$postdb[fonttype]','$postdb[picurl]','$postdb[ispic]','$postdb[yz]','$postdb[yzer]','$postdb[yztime]','$postdb[keywords]','$postdb[jumpurl]','$postdb[iframeurl]','$postdb[style]','$postdb[template]','$postdb[target]','$onlineip','0','$postdb[money]','$postdb[passwd]','$postdb[editer]','$postdb[edittime]','$postdb[begintime]','$postdb[endtime]','$postdb[description]','$postdb[levels]','$postdb[allowdown]','$postdb[allowview]','$mid','$postdb[htmlname]','$postdb[forbidcomment]')
");
换成:
$db->query("
INSERT INTO `{$pre}article$erp`
( `title`, `smalltitle`, `fid`,`fname`, `hits`, `pages`, `posttime`, `list`, `uid`, `username`, `author`, `copyfrom`, `copyfromurl`, `titlecolor`, `fonttype`, `picurl`, `ispic`, `yz`, `yzer`, `yztime`, `keywords`, `jumpurl`, `iframeurl`, `style`, `template`, `target`,`ip`, `lastfid`, `money`, `passwd`, `editer`, `edittime`, `begintime`, `endtime`, `description`, `levels`,allowdown,allowview,mid,htmlname,forbidcomment,diy001)
VALUES ('$postdb[title]','$postdb[smalltitle]','$fid','$fidDB[name]','$postdb[hits]','1','$postdb[posttime]','$postdb[list]','$lfjdb[uid]','$lfjdb[username]','$postdb[author]','$postdb[copyfrom]','$postdb[copyfromurl]','$postdb[titlecolor]','$postdb[fonttype]','$postdb[picurl]','$postdb[ispic]','$postdb[yz]','$postdb[yzer]','$postdb[yztime]','$postdb[keywords]','$postdb[jumpurl]','$postdb[iframeurl]','$postdb[style]','$postdb[template]','$postdb[target]','$onlineip','0','$postdb[money]','$postdb[passwd]','$postdb[editer]','$postdb[edittime]','$postdb[begintime]','$postdb[endtime]','$postdb[description]','$postdb[levels]','$postdb[allowdown]','$postdb[allowview]','$mid','$postdb[htmlname]','$postdb[forbidcomment]','$postdb[diy001]')
");
再把
$db->query("UPDATE `{$pre}article$erp` SET title='$postdb[title]',smalltitle='$postdb[smalltitle]',fid='$fid',fname='$fidDB[name]',hits='$postdb[hits]',posttime='$postdb[posttime]',list='$postdb
',author='$postdb[author]',copyfrom='$postdb[copyfrom]',copyfromurl='$postdb[copyfromurl]',titlecolor='$postdb[titlecolor]',fonttype='$postdb[fonttype]',picurl='$postdb[picurl]',ispic='$postdb[ispic]',yz='$postdb[yz]',levels='$postdb[levels]',keywords='$postdb[keywords]',jumpurl='$postdb[jumpurl]',iframeurl='$postdb[iframeurl]',style='$postdb[style]',template='$postdb[template]',target='$postdb[target]',money='$postdb[money]',passwd='$postdb[passwd]',editer='$userdb[username]',edittime='$timestamp',begintime='$postdb[begintime]',endtime='$postdb[endtime]',description='$postdb[description]',allowview='$postdb[allowview]',allowdown='$postdb[allowdown]',htmlname='$postdb[htmlname]',forbidcomment='$postdb[forbidcomment]' WHERE aid='$aid' ");
换成:
$db->query("UPDATE `{$pre}article$erp` SET title='$postdb[title]',smalltitle='$postdb[smalltitle]',fid='$fid',fname='$fidDB[name]',hits='$postdb[hits]',posttime='$postdb[posttime]',list='$postdb[list]',author='$postdb[author]',copyfrom='$postdb[copyfrom]',copyfromurl='$postdb[copyfromurl]',titlecolor='$postdb[titlecolor]',fonttype='$postdb[fonttype]',picurl='$postdb[picurl]',ispic='$postdb[ispic]',yz='$postdb[yz]',levels='$postdb[levels]',keywords='$postdb[keywords]',jumpurl='$postdb[jumpurl]',iframeurl='$postdb[iframeurl]',style='$postdb[style]',template='$postdb[template]',target='$postdb[target]',money='$postdb[money]',passwd='$postdb[passwd]',editer='$userdb[username]',edittime='$timestamp',begintime='$postdb[begintime]',endtime='$postdb[endtime]',description='$postdb[description]',allowview='$postdb[allowview]',allowdown='$postdb[allowdown]',htmlname='$postdb[htmlname]',forbidcomment='$postdb[forbidcomment]' ,diy001='$postdb[diy001]'WHERE aid='$aid' ");
最后编辑 template\default\becandy.htm
再要显示的地方放入:
自定义001: $rsdb[diy001]
比如链接:<A HREF='{$rsdb[diy001]}' target="_blank" title="支持正版">支持正版</A>
如果是在前台投稿,还需要修改:/member/template/post.htm文件(修改了此文件,更新后,其他模块也会自动生成,如果不想在后台,添加软件或视频等时,出现如文章模块中的这块,比如软件频道,根\data\admin_tpl\post_101.htm删除掉,会员模块\data\member_tpl\post_101.htm如果有,也删除掉。其他模块也一样。)
在
<input type="checkbox" name="postdb[target]" value="1" $target>
新窗口打开 $baseSpecial</td>
</tr>
下添加:
<tr bgcolor="#FFFFFF" class="basetr">
<td wiidth="15%">自定义001:</td>
<td wiidth="85%">
<input type="text" name="postdb[diy001]" size="60" value="$rsdb[diy001]">
</td>
</tr>
即可。