52AV手機A片王|52AV.ONE
標題:
discuz x3.2 標題字符從80改成160的方法
[打印本頁]
作者:
IT_man
時間:
2015-1-21 10:13
標題:
discuz x3.2 標題字符從80改成160的方法
==========================================================
5 y4 L0 V+ i: Q7 U9 n8 V
一、database修改,標題字數(英文字1Byte,中文2Bytes)為160字符:執行sql command:
- W% q! Y/ ?$ C
(注意改為你的表前缀)
9 U# e, w( a( k9 C$ t( t$ m
ALTER TABLE `pre_forum_post` CHANGE `subject` `subject` VARCHAR(120) NOT NULL;
1 _0 @$ E! U( y; D, K/ H
ALTER TABLE `pre_forum_rsscache` CHANGE `subject` `subject` char(120) NOT NULL;
" W( B @7 ^0 ?& w$ v# Z$ E
ALTER TABLE `pre_forum_thread` CHANGE `subject` `subject` char(120) NOT NULL;
' Z/ J8 F& C4 ?4 U* D$ W
- m- m7 g- ~4 ~) J2 `' b- M
或用phpdbadmin更改也可以
( x$ o/ R+ {, J# z+ L
==========================================================
: e1 ~+ d* i$ G8 O: i1 b* C, ~
二、修改JS驗證字符數:
3 u; W6 t( n& K. p( t
1、找到 static/js/forum_post.js的74-80行
9 Y! e! }& Z- P1 u
if(($('postsubmit').name != 'replysubmit' && !($('postsubmit').name == 'editsubmit' && !isfirstpost) && theform.subject.value == "") || !sortid && !special && trim(message) == "") {
3 y9 V, R4 _( O
showError('抱歉,您尚未輸入標題或內容);
1 E$ p h' }# B
return false;
) z7 o0 H! V$ |! m; R X
} else if(mb_strlen(theform.subject.value) > 80) {
" M/ m8 y4 @4 B% X7 u Z% g
showError('您的標題超過 80 個字符的限制');
( U6 L1 I& X! Q; k7 e) G+ v
return false;
' U1 V' k: d# u& E
}
. T ~' ~8 @8 E% d2 }, t: ~
8 i2 f. X/ e. Z/ S j7 _" {
數字80改為160
( X4 h, [; Q# k& T0 ?
==========================================================
* x$ U. c( y4 B
2、找到 sitatic/js/forum.js的209到215行:
K5 B) H8 n1 d+ u/ D8 J0 _
if(theform.message.value == '' && theform.subject.value == '') {
. k: G; v, L2 w8 s- z( G7 b
s = '抱歉,您尚未輸入標題或內容';
" z* ?, o9 m: L) r) S4 b
theform.message.focus();
1 {& l+ D }, y
} else if(mb_strlen(theform.subject.value) > 80) {
3 a q N Z0 c+ f8 }2 {, m. |( p
s = '您的標題超過 80 個字符的限制';
1 J5 @9 g- C3 {9 v; k
theform.subject.focus();
w* e4 N7 b: {. s S& I
}
% @: ~- s7 O. ]# e9 h5 v' N" t
# f" L h% e! m5 B6 f; o( q; j
2 i9 c5 h+ _& s' x Y: F
數字80改為160
+ R6 e# {1 a4 B$ ~6 W$ W& q
==========================================================
4 \0 @# g& t+ \! r
三、修改模板中寫死的字數限制:
' V& A/ e* k; ~
1、找到 template\default\forum\post_editor_extra.htm第25行開始
; W* U [' R. ~/ [& ~
修改前
$ T1 k) ?8 o$ E
<!--{if $_GET[action] != 'reply'}--
0 q) M8 T7 a% t5 ~( @: }0 G8 |) F
<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>
! B$ T; t" }' W/ F0 r
<!--{else}--><!--reply-->
- }" y% S* A: Z
<span id="subjecthide" class="z">RE: $thread[subject] [<a href="javascript:;"#ff0000">80);return false;">{lang modify}</a>]</span>
g1 r: `% N* W( {
<span id="subjectbox" style="display:none"><input type="text" name="subject" id="subject" class="px" value=""#ff0000">80);" style="width: 25em" /></span>
/ Z, a- [" g+ E& c( Q
<!--{/if}-->
`! F, v7 ? N+ D/ e
<span id="subjectchk"{if $_GET[action] == 'reply'} style="display:none"{/if}>{lang comment_message1} <strong id="checklen">80</strong> {lang comment_message2}</span>
) w9 t9 s9 B3 F: r/ ^5 m9 n# J
<script type="text/javascript">strLenCalc($('subject'), 'checklen',
80
)</script>
- i( t. y& u6 Q6 t
- D+ N& `7 i6 F! P# e( S
將紅色數字改為160
: K- j) Y" e/ H! F
==========================================================
/ l3 H2 I: H$ T# }7 k& o
2.找到 template\default\forum\forumdisplay_fastpost.htm 地31行開始
) J8 J; O7 n, Q2 `, K, N. x
修改前
9 L" f$ B- Q: v. \
<input type="text" id="subject" name="subject" class="px" value=""#ff0000">80);" tabindex="11" style="width: 25em" />
4 ^' d% t5 T1 Z
<span>{lang comment_message1} <strong id="checklen">80</strong> {lang comment_message2}</span>
- c2 M; f% H2 q7 T& n) q4 l! q
# M" M: L) L5 F7 p; m! g2 m
將紅色數字80改為160,第二個80可改可不改
1 M& R( g7 Z, Q. s' _$ D- j7 F
==========================================================
; Z0 Q8 N: }8 }9 k0 {1 B* h% P) j; c
四,修改function驗證提示:
' Y$ L0 F% I/ P1 n: S1 a
source/function/function_post.php的361-363行:
' A/ D: n; Z6 E) G8 K* F
修改前
: p$ u& c: _* d6 F/ ^+ E0 J
if(dstrlen($subject) > 80) {
1 _$ i9 ^$ q; a; F0 H
return 'post_subject_toolong';
9 j7 T a& A9 ]+ X4 [% ^
}
: s3 ^4 i0 M6 j$ t1 [' d/ o* ?: R
將數字80改為160
- ]# }% M7 W( m4 A2 c' B- T
==========================================================
4 k2 S) c9 _/ G) ^, s
五、找到訊息提示文字的php檔,打開 source/language/lang_messege.php 找到998行改為:
/ e9 j: g6 [4 j- H
'post_subject_toolong' => '抱歉,您的標題超過 160 個字符修改標題長度',
( O* Q6 H4 l: O. h
==========================================================
5 ~" b, }6 A) z
上面五個步驟完成記得最後最重要的一個步驟是到後台更新緩存才會生效喔
/ S7 R& A% ^5 v y( D0 @6 K3 {
歡迎光臨 52AV手機A片王|52AV.ONE (https://www.52av23.xyz/)
Powered by Discuz! X3.2