Discuz 修改主题标题长度方法

全屏阅读
  • 基本信息
  • 作者:
  • 作者已发布:924篇文章
  • 发布时间:2020年03月07日 18:16:09
  • 所属分类:Discuz
  • 阅读次数:3641次阅读
  • 标签:

以标题长度为 120 个字符为例

修改JS验证字符数:1、找到文件static/js/forum_post.js
} else if(mb_strlen(theform.subject.value) > 80) {
showError('您的标题超过 80 个字符的限制');
return false;
}
修改为:
} else if(mb_strlen(theform.subject.value) > 120) {
showError('您的标题超过 120 个字符的限制');
return false;
}
2、找到文件sitatic/js/forum.js
if(theform.message.value == '' && theform.subject.value == '') {
                s = '抱歉,您尚未输入标题或内容';
                theform.message.focus();
        } else if(mb_strlen(theform.subject.value) > 80) {
                s = '您的标题超过 80 个字符的限制';
                theform.subject.focus();
        }
修改为:
if(theform.message.value == '' && theform.subject.value == '') {
                s = '抱歉,您尚未输入标题或内容';
                theform.message.focus();
        } else if(mb_strlen(theform.subject.value) > 120) {
                s = '您的标题超过 120 个字符的限制';
                theform.subject.focus();
        }
3、修改模板中写死的字符限制数:1)找到文件\template\default\forum\post_editor_extra.htm

<!--{if $_G[gp_action] != 'reply'}-->
<span><input type="text" name="subject" id="subject" class="px" value="$postinfo[subject]" {if $_G[gp_action] == 'newthread'}onblur="if($('tags')){relatekw('-1','-1'{if $_G['group']['allowposttag']},function(){extraCheck(4)}{/if});doane();}"{/if} style="width: 25em" tabindex="1" /></span>
<!--{else}-->
<span id="subjecthide" class="z">RE: $thread[subject] [<a href="javascript:;">{lang modify}</a>]</span>
<span id="subjectbox" style="display:none"><input type="text" name="subject" id="subject" class="px" value="" style="width: 25em" /></span>
<!--{/if}-->
<span id="subjectchk"{if $_G[gp_action] == 'reply'} style="display:none"{/if}>{lang comment_message1} <strong id="checklen">80</strong> {lang comment_message2}</span>
修改为下面代码:
<!--{if $_G[gp_action] != 'reply'}-->
<span><input type="text" name="subject" id="subject" class="px" value="$postinfo[subject]" {if $_G[gp_action] == 'newthread'}onblur="if($('tags')){relatekw('-1','-1'{if $_G['group']['allowposttag']},function(){extraCheck(4)}{/if});doane();}"{/if} style="width: 25em" tabindex="1" /></span>
<!--{else}-->
<span id="subjecthide" class="z">RE: $thread[subject] [<a href="javascript:;">{lang modify}</a>]</span>
<span id="subjectbox" style="display:none"><input type="text" name="subject" id="subject" class="px" value="" style="width: 25em" /></span>
<!--{/if}-->
<span id="subjectchk"{if $_G[gp_action] == 'reply'} style="display:none"{/if}>{lang comment_message1} <strong id="checklen">120</strong> {lang comment_message2}</span>
2)找到文件\template\default\forum\forumdisplay_fastpost.htm
<input type="text" id="subject" name="subject" class="px" value="" tabindex="11" style="width: 25em" />
<span>{lang comment_message1} <strong id="checklen">80</strong> {lang comment_message2}</span>
修改为:
<input type="text" id="subject" name="subject" class="px" value="" tabindex="11" style="width: 25em" />
<span>{lang comment_message1} <strong id="checklen">120</strong> {lang comment_message2}</span>
4,修改函数验证提示:找到文件source/function/function_post.php
if(dstrlen($subject) > 80) {
return 'post_subject_toolong';
}
修改为:
if(dstrlen($subject) > 120) {
return 'post_subject_toolong';
}
5、找到语言包提示文字,打开 source/language/lang_messege.php  
  'post_subject_toolong' => '抱歉,您的标题超过 120 个字符修改标题长度',
OK,你再发表帖子标题就可以是120个字符数了!!!
数据库及要修改的字段:
ALTER TABLE 表名 modify subject varchar(XXX)
pre_forum_post 表 subject 字段
pre_forum_thread 表 subject 字段
forum_collection 表 lastsubject 字段 

forum_fourmrecommend 表 subject 字段 

forum_rsscache 表 subject 字段



(修改数据库,请先备份数据库)

或者直接执行以下SQL   注意表前缀要改成您自己的哦

ALTER TABLE `pre_forum_post` CHANGE `subject` `subject` VARCHAR(200) NOT NULL;

ALTER TABLE `pre_forum_rsscache` CHANGE `subject` `subject` char(200) NOT NULL;

ALTER TABLE `pre_forum_thread` CHANGE `subject` `subject` char(200) NOT NULL;

ALTER TABLE `pre_forum_collection` CHANGE `lastsubject` `lastsubject` char(200) NOT NULL;

ALTER TABLE `pre_forum_forumrecommend` CHANGE `subject` `subject` char(200) NOT NULL;

顶一下
(0)
100%
订阅 回复
踩一下
(0)
100%
» 郑重声明:本文由mpxq168发布,所有内容仅代表个人观点。版权归恒富网mpxq168共有,欢迎转载, 但未经作者同意必须保留此段声明,并给出文章连接,否则保留追究法律责任的权利! 如果本文侵犯了您的权益,请留言。

目前有 0 条留言 其中:访客:0 条, 博主:0 条

给我留言

您必须 [ 登录 ] 才能发表留言!