麻豆小视频在线观看_中文黄色一级片_久久久成人精品_成片免费观看视频大全_午夜精品久久久久久久99热浪潮_成人一区二区三区四区

首頁 > 網站 > 建站經驗 > 正文

Discuz! X2.5論壇標題字數突破80的限制實現思路

2024-04-25 20:33:45
字體:
來源:轉載
供稿:網友

當一些用戶發布帖子的時候標題要是超過了80個字符超出的部分被剪切掉了,特別是一些用戶發送一些英文或其他其語言的文章的時候標題說甚至會超過180個字符,又特別論壇編碼是UTF-8格式,因為一個字占3個字節,所以標題最長也就26個漢字,很多用戶想修改這個80個字符的限制。

想去掉這個字數限制,要從下面五個部分來修改:

一、數據庫修改;

二、修改JS驗證字符數文件;

三、修改模板中寫死的字符限制數;

四,修改函數驗證文件;

五,修改語言包文件。

現以把標題字符限制80修改為120為例子,描述一下修改方法:

一、數據庫修改,修改數據庫標題字段的長度為120字符:運行下面的sql語句:

(注意修改你的表的前綴)

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

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

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

二、修改JS驗證字符數:1、找到文件static/js/forum_post.js的74-80行

if(($('postsubmit').name != 'replysubmit' && !($('postsubmit').name == 'editsubmit' && !isfirstpost) && theform.subject.value == "") || !sortid && !special && trim(message) == "") {

showError('抱歉,您尚未輸入標題或內容');

return false;

} else if(mb_strlen(theform.subject.value) > 80) {

showError('您的標題超過 80 個字符的限制');

return false;

}

修改為:

if(($('postsubmit').name != 'replysubmit' && !($('postsubmit').name == 'editsubmit' && !isfirstpost) && theform.subject.value == "") || !sortid && !special && trim(message) == "") {

showError('抱歉,您尚未輸入標題或內容');

return false;

} else if(mb_strlen(theform.subject.value) > 120) {

showError('您的標題超過 120 個字符的限制');

return false;

}

2、找到文件sitatic/js/forum.js的209到215行代碼:

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();

}

三、修改模板中寫死的字符限制數:

1、找到文件templatedefaultforumpost_editor_extra.htm的25到31行:

<!--{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、找到文件templatedefaultforumforumdisplay_fastpost.htm31-32行:

<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>

四,修改函數驗證提示:

找到文件source/function/function_post.php的346-348行:

if(dstrlen($subject) > 80) {

return 'post_subject_toolong';

}

修改為:

if(dstrlen($subject) > 120) {

return 'post_subject_toolong';

}

五、找到語言包提示文字,打開 source/language/lang_messege.php 并找到985行改為:

'post_subject_toolong' => '抱歉,您的標題超過 120 個字符修改標題長度',

OK,你再發表帖子標題就可以是120個字符數了!!!

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 成人精品一区二区三区中文字幕 | 色淫视频 | 精精国产xxxx视频在线播放7 | 成人男女啪啪免费观看网站四虎 | 热99精品视频 | 欧美a视频 | 国产精品久久久乱弄 | 一级免费大片 | 久久久久久久一区二区 | 天堂成人国产精品一区 | 免费午夜视频在线观看 | 精品亚洲一区二区三区 | av噜噜在线 | 国产精品视频一区二区三区四区五区 | 98色视频| 18欧美性xxxx极品hd | 国产porn在线| 免费观看黄色一级视频 | 久久久中精品2020中文 | 亚洲精品午夜在线 | 99麻豆久久久国产精品免费 | 久久久免费电影 | 欧美aⅴ视频 | 狠狠99 | 国产精品麻豆一区二区三区 | 欧美视屏一区二区 | 一区二区免费网站 | 久久免费观看一级毛片 | 青青草国产在线视频 | 欧美成人免费小视频 | 毛片视频播放 | 日产精品一区二区三区在线观看 | 国产欧美精品一区二区三区四区 | 久久精品99北条麻妃 | 日韩精品免费看 | 深夜福利视频绿巨人视频在线观看 | 黄视频网站免费在线观看 | 看免费的毛片 | 午夜视频福利 | 在线看免电影网站 | 羞羞的动漫在线观看 |