Discuz!X3.2帖子标题限制80个字符的修改方法

修改为200

第一步、执行SQL语句

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;

第二步、修改JS文件
打开 /static/js/forum_post.js 文件
查找
else if(mb_strlen(theform.subject.value) > 80) {
        s = '您的标题超过 80 个字符的限制';
        theform.subject.focus();
}

修改为

else if(mb_strlen(theform.subject.value) > 200) {
        s = '您的标题超过 200 个字符的限制';
        theform.subject.focus();
} 
打开 /static/js/forum.js 文件
查找
else if(mb_strlen(theform.subject.value) > 80) {
        showError('您的标题超过 80 个字符的限制');
        return false;
    }

修改为

else if(mb_strlen(theform.subject.value) > 200) {
        showError('您的标题超过 200 个字符的限制');
        return false;
    } 

第三步、修改模板文件
打开 /template/default/forum/post_editor_extra.htm 文件
查找
<span><input type="text" name="subject" id="subject" class="px" value="$postinfo[subject]" {if $_GET[action] == 'newthread'}onblur="if($('tags')){relatekw('-1','-1'{if $_G['group']['allowposttag']},function(){extraCheck(4)}{/if});doane();}"{/if} onkeyup="strLenCalc(this, 'checklen', 80);" style="width: 25em" tabindex="1" /></span>
            <!--{else}-->
                <span id="subjecthide" class="z">RE: $thread[subject] [<a href="javascript:;" onclick="display('subjecthide');display('subjectbox');$('subject').value='RE: {echo dhtmlspecialchars(str_replace('\'', '\\\'', $thread[subject]))}';display('subjectchk');strLenCalc($('subject'), 'checklen', 80);return false;">{lang modify}</a>]</span>
                <span id="subjectbox" style="display:none"><input type="text" name="subject" id="subject" class="px" value="" onkeyup="strLenCalc(this, 'checklen', 80);" style="width: 25em" /></span>
            <!--{/if}-->            
            <span id="subjectchk"{if $_GET[action] == 'reply'} style="display:none"{/if}>{lang comment_message1} <strong id="checklen">80</strong> {lang comment_message2}</span>
            <script type="text/javascript">strLenCalc($('subject'), 'checklen', 80)</script>
修改为

<span><input type="text" name="subject" id="subject" class="px" value="$postinfo[subject]" {if $_GET[action] == 'newthread'}onblur="if($('tags')){relatekw('-1','-1'{if $_G['group']['allowposttag']},function(){extraCheck(4)}{/if});doane();}"{/if} onkeyup="strLenCalc(this, 'checklen', 200);" style="width: 25em" tabindex="1" /></span>
            <!--{else}-->
                <span id="subjecthide" class="z">RE: $thread[subject] [<a href="javascript:;" onclick="display('subjecthide');display('subjectbox');$('subject').value='RE: {echo dhtmlspecialchars(str_replace('\'', '\\\'', $thread[subject]))}';display('subjectchk');strLenCalc($('subject'), 'checklen', 200);return false;">{lang modify}</a>]</span>
                <span id="subjectbox" style="display:none"><input type="text" name="subject" id="subject" class="px" value="" onkeyup="strLenCalc(this, 'checklen', 200);" style="width: 25em" /></span>
            <!--{/if}-->            
            <span id="subjectchk"{if $_GET[action] == 'reply'} style="display:none"{/if}>{lang comment_message1} <strong id="checklen">200</strong> {lang comment_message2}</span>
            <script type="text/javascript">strLenCalc($('subject'), 'checklen', 200)</script>


打开 /template/default/forum/forumdisplay_fastpost.htm 文件
查找
<input type="text" id="subject" name="subject" class="px" value="" onkeyup="strLenCalc(this, 'checklen', 80);" 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="" onkeyup="strLenCalc(this, 'checklen', 200);" tabindex="11" style="width: 25em" />
                <span>{lang comment_message1} <strong id="checklen">200</strong> {lang comment_message2}</span>
第四步、修改函数
打开 /source/function/function_post.php 文件
找到:
if(dstrlen($subject) > 80) {
return 'post_subject_toolong';
}

修改为:
if(dstrlen($subject) > 200) {
return 'post_subject_toolong';
}

第五步、语言包修改
打开 /source/language/lang_messege.php 文件
找到
'post_subject_toolong' => '抱歉,您的标题超过 80 个字符修改标题长度',
修改为
'post_subject_toolong' => '抱歉,您的标题超过 200 个字符修改标题长度'

 

posted @ 2018-09-11 09:29  码农耕耘  阅读(250)  评论(0编辑  收藏  举报