| 收藏本站 | 关于我们
首页 免费模板 收费模板 部分案例 分类模板 地方门户 二次修改 服务定制 酷站欣赏 设计学院 特效代码 字体下载
当前位置:首页 >> 二次修改
添加整站核心系统(文章模型)自定义字段应用教程
发布时间:2014-09-25 10:26:37
原创作者:lisheng51
1040_81067_e3f23a90e346cca.jpg

一般情况下,大家可以在网站内容模型管理界面下添加自定义模型的字段,如果你想添加默认的文章模型字段,就是在p8_article数据表中,并给予后台设置和前台调用的话,就需要参考本帖。



先在数据表p8_article中添加新的数据字段,留意自己安装时设置的表区分符,默认是p8_

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  width="15%">自定义001:</td>
                  <td  width="85%">
                     <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]

ps:本教程适合有php基本基础的用户,如果你连html都不会,介意先去网络学习下再来防止操作过程出错。

点击率:1043
相关文章
网页特效代码
 服务流程 | 积分说明 | 使用说明 | 粤ICP备17004399号 电视直播 | QQ头像获取