分享

[功能修改] Discuz!X3.2 x3.3 x3.4 帖子标题限制80个字符的修改方法

[复制链接]

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

发表于 2020-1-5 20:38:00 来自 功能修改 阅读模式 倒序浏览
1413 0 查看全部
以修改为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} 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 $_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} 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 $_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=”” 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”>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 个字符修改标题长度’


回复

使用道具 举报

游客~
懒得打字嘛,点击右侧快捷回复
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

Archiver|手机版|小黑屋| 鲸云论坛

© 2013-2016 Comsenz Inc. Powered by Discuz! X3.4