honeytung 發表於 31-1-2011 11:23:14

標題80字元限制

Discuz修改文章標題最大長度

Discuz預設標題是80個位元,等於40個中文字
但是由於UTF8一個中文字等於3個位元
所以Discuz預設80個位元只剩26個中文字
偶爾可能會出現不夠用的狀況

修改方法,把下列提到的 80 改成想要的數字
上限255 ,120 = 40個 UTF-8 中文字

1.include/post.func.phpif(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.phpif(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(XXX) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL
ALTER TABLE `cdb_threads` CHANGE `subject` `subject` CHAR(XXX) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL
頁: [1]
查看完整版本: 標題80字元限制