发贴样本(post template) by lu5266

上一篇 / 下一篇  2006-01-19 22:10:06

查看( 7208 ) / 评论( 42 )


QUOTE:
版本:  4.00
作者:  lu5266
难易:  一般
文件: admin/forums.inc.php  post.php  (forumdisplay.php)
模板: admincp.lang.php  post_bbinsert.htm  
数据库: 有升级
演示:   http://www.5466.ik8.com/            
功能:   话题类型和发贴模板预先在后台定制,极大地方便会员发贴,特别是bt论坛,电影论坛. 具有后台管理,各版快独立,有开关,(虽然有数据库升级,但没单独加查询)
这个2.5的时候弄了,现在尽量把不好改到最好的




1:后台升级数据库:

ALTER TABLE `cdb_forumfields` ADD `isamp` TINYINT( 1 ) NOT NULL DEFAULT '-1' AFTER `password` ,
ADD `samsub` TEXT NOT NULL AFTER `isamp` ,
ADD `sammsg` TEXT NOT NULL AFTER `samsub` ;
2:修改admin/forums.php


查找:

description='$descriptionnew',
面加上:

isamp='$isampnew',samsub='$samsubnew',sammsg='$sammsgnew',
查找:

showsetting('forums_edit_icon', 'iconnew', $forum['icon'], 'text');
在下面加上:

                        //=====posthread template start By lu5266 ==================//
                        showsetting('forums_edit_isamp', 'isampnew', $forum['isamp'], 'text');
                        showsetting('forums_edit_samsub', 'samsubnew', $forum['samsub'], 'textarea');
                        showsetting('forums_edit_sammsg', 'sammsgnew', $forum['sammsg'], 'textarea');
                        //=====posthread template end  By www.5466.ik8.com ==========//
3:====
在post.php查找:

if($action == 'newthread') {
在forumdisplay.php查找(快速发贴的也用,想不用就不加):

include template('forumdisplay');
在上面加上:

//=====posthread template start By lu5266 ==================//
$sam_str='';
if($forum['isamp']!=-1){
$sam_str='<script language=javascript defer>sother="";';
foreach(explode("\n",$forum['sammsg']) as $i=> $value)
$sam_str.='sam'.$i.'="'.trim($value).'";';
if($action == 'newthread'  && $forum[isamp]==1 ) $sam_str.='document.input.message.value=sam0;';
$sam_str.='</script>';
$sam_str.='<select onchange="AddText(eval(this.options[this.selectedIndex].value))" ><option value="sother" selected>select sample</option>';
foreach(explode("\n",$forum['samsub']) as $i=> $value)         
$sam_str.='<OPTION value=sam'.$i.'>'.trim($value).'</OPTION>';   
$sam_str.='</select>';   
}
//=====posthread template end  By www.5466.ik8.com ==========//
4:在模板post_bbinsert.htm
查找:

<br><br>
在上面加上:

$sam_str
5:语言包admincp.lang.php  

查找:

'forums_edit_icon' => '论坛图标:',
上面加上:

'forums_edit_isamp' => '发贴样本开关:',
        'forums_edit_isamp_comment' => '-1 为关闭, 1 为进入发贴页面就直接出现第一个样本, 2 就是开启,但进入没有直接出现',
        'forums_edit_samsub' => '样本标题:',
        'forums_edit_samsub_comment' => '样本标题,出现在下拉中;例如:简单样本,高级样本; 每个标题是以回车为标志,就是5个标题要回车4次来分开',
        'forums_edit_sammsg' => '样本内容:',
        'forums_edit_sammsg_comment' => '样本内容,出现在帖子里;要与上面的标题相对应, 每个内容是以回车为标志,就是5个内容要回车4次来分开,假如内容要换行可以用\n来,用\t就是是空8格',
6:摸板forumdisplay.htm(快速发贴使用的就做)

查找:

{template post_bbinsert}
假如能找到,这步完成.没有的话,就

查找:

$typeselect
前面加上:

<script language="JavaScript" src="include/bbcode.js"></script>$sam_str
所有的完工

TAG:

我来说两句

(可选)

Open Toolbar