設為首頁收藏本站

 取回密碼
 註冊
搜尋
熱搜: Redump discuz
檢視: 491|回覆: 0

【轉貼】 Discuz X3.4 修改標題限制

[複製連結]
發表於 2021年3月2日 02:07:26 | 顯示全部內容 |閱讀模式

修改論壇標題字數限制,下面五個部分需要修改:

一、資料庫
二、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;



或是把pre_forum_post、pre_forum_rsscache、pre_forum_thread的subject長度改成120

下面的全部都是需要把80改成120的文件

二、JS驗證:
1、找到文件static/js/forum_post.js
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;
        }


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



三、模板:
1、找到文件\template\default\forum\post_editor_extra.htm

修改5個 "80"

**這一段程式碼貼不出來

2、找到文件\template\default\forum\forumdisplay_fastpost.htm
<input type="text" id="subject" name="subject" class="px" value=""#0000ff">80);" tabindex="11" style="width: 25em" />
<span>{lang comment_message1} <strong id="checklen">80</strong> {lang comment_message2}</span>



四,函數驗證:
找到文件source/function/function_post.php
if(dstrlen($subject) > 80) {
return 'post_subject_toolong';
}


五、找到語言包提示文字,打開 source/language/lang_messege.php
  'post_subject_toolong' => '抱歉,您的標題超過 80 個字符修改標題長度',
作者文章推薦
懶得打字嗎?讓本助手協助你 【使用進階編輯器請點選右方進階模式】
您需要登入後才可以回覆 登入 | 註冊

本版積分規則

手機版|Archiver|漁家小舖

GMT+8, 2024年4月25日 02:36 , Processed in 0.377550 second(s), 17 queries , Gzip On, Redis On.

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

快速回覆 返回頂端 返回清單