| 
 | 
 
Discuz修改文章標題最大長度 
 
Discuz預設標題是80個位元,等於40個中文字 
但是由於UTF8一個中文字等於3個位元 
所以Discuz預設80個位元只剩26個中文字 
偶爾可能會出現不夠用的狀況 
 
修改方法,把下列提到的 80 改成想要的數字 
上限255 ,120 = 40個 UTF-8 中文字  
 
1.include/post.func.php- if(strlen($subject) > 80) {
 
  複製代碼 2.include/js/post.js- } else if(mb_strlen(theform.subject.value) > 80) {
 
 -         showDialog('您的標題超過 80 個字符的限制。');
 
  複製代碼 3.include/js/viewthread.js- } else if(mb_strlen(theform.subject.value) > 80) {
 
 -         s = '您的標題超過 80 個字符的限制。';
 
  複製代碼 4.modcp/editpost.inc.php- if(strlen($subjectnew) > 80) {
 
  複製代碼 5.templates/default/messages.lang.php- 'post_subject_toolong' => '對不起,您的標題超過 80 個字符,請返回修改標題長度。',
 
  複製代碼 6.templates/default/wap.lang.php- 'post_subject_toolong' => '標題超過80字節',
 
  複製代碼 7.修改MySQL 
將資料表  cdb_posts , cdb_threads  的 subject 的 varchar(80) 或 char(80) 
80改成想要的數字 
 
以下為 UTF-8 的 MySQL 語法 (XXX為需要改的地方)- ALTER TABLE `cdb_posts` CHANGE `subject` `subject` VARCHAR([color=Red]XXX[/color]) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL 
 
 - ALTER TABLE `cdb_threads` CHANGE `subject` `subject` CHAR([color=Red]XXX[/color]) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL
 
  複製代碼 |   
 
 
 
 |