52AV手機A片王|52AV.ONE
標題:
discuz x3.2 標題字符從80改成160的方法
[打印本頁]
作者:
IT_man
時間:
2015-1-21 10:13
標題:
discuz x3.2 標題字符從80改成160的方法
==========================================================
2 B8 x! \3 f; J; f, D& z
一、database修改,標題字數(英文字1Byte,中文2Bytes)為160字符:執行sql command:
- n! s; K2 o4 [6 X6 A( V: E/ H
(注意改為你的表前缀)
* S/ g. F7 n$ X8 X* A
ALTER TABLE `pre_forum_post` CHANGE `subject` `subject` VARCHAR(120) NOT NULL;
: ?# f% F3 `6 L' }, a8 S$ c6 [
ALTER TABLE `pre_forum_rsscache` CHANGE `subject` `subject` char(120) NOT NULL;
r- [$ O9 ~! E# g$ Q- f, R
ALTER TABLE `pre_forum_thread` CHANGE `subject` `subject` char(120) NOT NULL;
6 ?- e& C7 T' N9 i8 M. n
' g; q8 i$ \) t) p( K3 x
或用phpdbadmin更改也可以
/ n5 V* e7 ~9 ] M% b' T
==========================================================
; q+ w3 I& Q6 t( H* E1 _# j
二、修改JS驗證字符數:
* B& M6 y# J" K2 q& a2 M3 N
1、找到 static/js/forum_post.js的74-80行
7 I6 A: m3 R+ V; t- [
if(($('postsubmit').name != 'replysubmit' && !($('postsubmit').name == 'editsubmit' && !isfirstpost) && theform.subject.value == "") || !sortid && !special && trim(message) == "") {
( L+ f$ C6 J# _3 g' C' {- _
showError('抱歉,您尚未輸入標題或內容);
& ?8 [+ b/ a' c' A7 y% l3 x1 b, W
return false;
5 `* ^% D) ?; i) i: \
} else if(mb_strlen(theform.subject.value) > 80) {
) V" m$ l7 y1 n
showError('您的標題超過 80 個字符的限制');
: X P7 J; H3 [- u: m- k
return false;
4 f% N, S5 A% t+ J! `6 ^
}
/ P% ^" r. b @/ ]5 m
* V! C; X1 S2 s' n
數字80改為160
! Y+ D+ [! R- i+ m. y
==========================================================
2 Z& A4 F9 @, C7 y) G0 s
2、找到 sitatic/js/forum.js的209到215行:
8 n2 b0 ~' E" n8 Q* Y+ M
if(theform.message.value == '' && theform.subject.value == '') {
5 d2 b$ U) x2 [/ w
s = '抱歉,您尚未輸入標題或內容';
. @ b5 ~7 ]. ?$ a7 ~0 ^
theform.message.focus();
3 v$ r! P8 L. [* ^3 D$ Y; Z$ ~* L+ I
} else if(mb_strlen(theform.subject.value) > 80) {
2 B5 h: q/ v/ \6 I9 Q4 f
s = '您的標題超過 80 個字符的限制';
@: |* R7 N3 w1 t- W/ t# }
theform.subject.focus();
* `$ X7 l$ D3 i
}
; n: ^) U; B' I) f# H
9 D/ W- F, @# d7 F% N7 F
! V! U$ n/ S5 m- G: B
數字80改為160
$ ]0 p$ y* S1 }( C7 c) |
==========================================================
6 H9 _9 U% L8 M- X2 U3 k
三、修改模板中寫死的字數限制:
4 G0 o# Y( Y5 y
1、找到 template\default\forum\post_editor_extra.htm第25行開始
! ~5 g* d8 O2 l0 F
修改前
n2 c2 |5 Y4 L
<!--{if $_GET[action] != 'reply'}--
* C9 M' s p7 S" l
<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}#ff0000">80);" style="width: 25em" tabindex="1" /></span>
* T8 m( `5 q( t. W4 p& P
<!--{else}--><!--reply-->
7 _) ~5 ~4 A* M: W+ ?
<span id="subjecthide" class="z">RE: $thread[subject] [<a href="javascript:;"#ff0000">80);return false;">{lang modify}</a>]</span>
0 }8 c9 G1 U, p# L3 ~
<span id="subjectbox" style="display:none"><input type="text" name="subject" id="subject" class="px" value=""#ff0000">80);" style="width: 25em" /></span>
. r% [, B- ]7 [1 k2 M1 j! v, _$ F2 m
<!--{/if}-->
* M0 ]; j2 y6 B
<span id="subjectchk"{if $_GET[action] == 'reply'} style="display:none"{/if}>{lang comment_message1} <strong id="checklen">80</strong> {lang comment_message2}</span>
. {9 j2 m( o$ |7 N) e5 w5 x/ o* W
<script type="text/javascript">strLenCalc($('subject'), 'checklen',
80
)</script>
0 T) K3 }# T6 D( V: L& G7 A
1 r# Z1 |; d7 y2 g
將紅色數字改為160
* z" f; ^/ B* d U+ G$ p1 q/ ?
==========================================================
) R$ q& N" L! _( v
2.找到 template\default\forum\forumdisplay_fastpost.htm 地31行開始
+ E* U5 M2 [, I
修改前
7 D& |0 V9 J- N* X- X$ ^
<input type="text" id="subject" name="subject" class="px" value=""#ff0000">80);" tabindex="11" style="width: 25em" />
5 f5 p% t5 n- |1 T8 z( ^% W2 I
<span>{lang comment_message1} <strong id="checklen">80</strong> {lang comment_message2}</span>
; m. j1 T' J7 `+ _- j. Q% `: u& Z$ o" t
3 W" U3 U: V3 h' I0 n
將紅色數字80改為160,第二個80可改可不改
) p3 Q ^" _: j' ]1 J; F, M M
==========================================================
6 O% S; L/ o9 f
四,修改function驗證提示:
" X: _- L: v+ @5 q$ x/ i/ X
source/function/function_post.php的361-363行:
2 J3 a" q& Y2 y8 a9 Z
修改前
5 ~# _7 x+ D' e5 U7 k, I, l
if(dstrlen($subject) > 80) {
. x0 Y. R/ P: x$ }4 n3 `
return 'post_subject_toolong';
5 P; f$ R4 a9 q: N
}
* O2 @7 p1 r8 m8 o- B
將數字80改為160
" V& C! C6 H8 L/ f0 B3 `8 x8 ~+ j* [
==========================================================
( ~ J3 D6 |, ~- V
五、找到訊息提示文字的php檔,打開 source/language/lang_messege.php 找到998行改為:
7 g8 h5 ?9 k" _$ N, A0 a
'post_subject_toolong' => '抱歉,您的標題超過 160 個字符修改標題長度',
% c e& F3 [5 B2 R7 M( \9 ]
==========================================================
" u! o% n8 v! q& i: X- T. \) }/ t- Y
上面五個步驟完成記得最後最重要的一個步驟是到後台更新緩存才會生效喔
' j0 A# p1 r: J: Z9 `- l+ J
歡迎光臨 52AV手機A片王|52AV.ONE (https://www.52av.one/)
Powered by Discuz! X3.2