52AV手機A片王|52AV.ONE
標題:
discuz x3.2 標題字符從80改成160的方法
[打印本頁]
作者:
IT_man
時間:
2015-1-21 10:13
標題:
discuz x3.2 標題字符從80改成160的方法
==========================================================
& r w# N" |$ K! M( r& a5 U8 o
一、database修改,標題字數(英文字1Byte,中文2Bytes)為160字符:執行sql command:
& x" Q0 B. B. K% x. M3 n. A
(注意改為你的表前缀)
2 l) g: C( P- x( L7 G$ d
ALTER TABLE `pre_forum_post` CHANGE `subject` `subject` VARCHAR(120) NOT NULL;
& S+ k7 W. c; s# |
ALTER TABLE `pre_forum_rsscache` CHANGE `subject` `subject` char(120) NOT NULL;
6 r6 M+ r1 m/ Y
ALTER TABLE `pre_forum_thread` CHANGE `subject` `subject` char(120) NOT NULL;
7 D5 |, \* N% D, r
/ w: X' `" d7 J. M& k! y
或用phpdbadmin更改也可以
1 \7 C& o" _. Y
==========================================================
+ A0 ^! Q6 m5 t m
二、修改JS驗證字符數:
# u6 u; T# J# u6 h# U! F
1、找到 static/js/forum_post.js的74-80行
1 `. W9 w% B( ?
if(($('postsubmit').name != 'replysubmit' && !($('postsubmit').name == 'editsubmit' && !isfirstpost) && theform.subject.value == "") || !sortid && !special && trim(message) == "") {
% n4 e: l. v, U4 A5 l3 G
showError('抱歉,您尚未輸入標題或內容);
& c: h' c5 H0 Z6 t0 s9 F7 B
return false;
6 Z( H' ?5 L5 A+ ?6 k5 E3 p) W
} else if(mb_strlen(theform.subject.value) > 80) {
5 f. X# {& x$ W! @1 d0 q
showError('您的標題超過 80 個字符的限制');
* L/ V" v- \/ X7 R
return false;
$ G/ W2 ?9 T A" ~. S8 V
}
: B% y! T; U4 t- `, c
3 D) R; Z) p1 e- T. F: z
數字80改為160
2 z$ U* U# t2 \ Y2 |
==========================================================
6 S1 V+ L, ]- G# j) _- M7 v8 n# {
2、找到 sitatic/js/forum.js的209到215行:
" @& U0 p: L# @5 Q& E9 e
if(theform.message.value == '' && theform.subject.value == '') {
/ ` N W- X( z3 ]- L3 K4 k" V. j5 I
s = '抱歉,您尚未輸入標題或內容';
1 h8 G; w! G c6 b; \! M8 p
theform.message.focus();
6 ]5 _1 Q7 c: x5 ]8 n% u5 T. E% n
} else if(mb_strlen(theform.subject.value) > 80) {
3 Y1 u0 T( M! [3 S
s = '您的標題超過 80 個字符的限制';
- ? T: @' b5 B" f& ^6 Q6 d
theform.subject.focus();
3 A" b+ T+ e# q8 N( w$ D! H
}
/ u# N3 B* a, P8 M+ a- F& R
/ s- r2 [0 i+ h' E+ M, v
+ ~! J7 ?5 x+ A) k$ ~* s" y, x
數字80改為160
+ R3 l; r* }! T8 l1 n( {2 d. S, N
==========================================================
( g% f* u: D8 C* X
三、修改模板中寫死的字數限制:
6 F1 n' O k9 {
1、找到 template\default\forum\post_editor_extra.htm第25行開始
5 F# R" a# X0 ]2 a" i# i3 l
修改前
( |9 _- l0 H7 J9 b( C
<!--{if $_GET[action] != 'reply'}--
0 Y: f& t N$ L) z; C
<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>
7 A' A, l Y* N$ s
<!--{else}--><!--reply-->
# J2 y* X! s) s2 T* ]: W( h
<span id="subjecthide" class="z">RE: $thread[subject] [<a href="javascript:;"#ff0000">80);return false;">{lang modify}</a>]</span>
7 {2 O) ~% I' |$ W5 I$ {
<span id="subjectbox" style="display:none"><input type="text" name="subject" id="subject" class="px" value=""#ff0000">80);" style="width: 25em" /></span>
1 F+ u% E; `" T* }3 c6 b# c) m0 }/ f
<!--{/if}-->
& } A. u1 ^( ^/ s; [
<span id="subjectchk"{if $_GET[action] == 'reply'} style="display:none"{/if}>{lang comment_message1} <strong id="checklen">80</strong> {lang comment_message2}</span>
7 j. N& b% T9 S& j
<script type="text/javascript">strLenCalc($('subject'), 'checklen',
80
)</script>
1 s" i E0 l+ @ p, o% N, ^3 ~8 c
/ ]/ |$ L# j, {! P! y0 G3 i, p4 w
將紅色數字改為160
$ l2 ~6 H; @4 A/ F* F! c
==========================================================
/ ^3 \8 Q' K: g; T9 ?/ S
2.找到 template\default\forum\forumdisplay_fastpost.htm 地31行開始
$ _ A: X+ |2 J$ [
修改前
2 A* b# j6 U& V+ K7 G5 a
<input type="text" id="subject" name="subject" class="px" value=""#ff0000">80);" tabindex="11" style="width: 25em" />
- u2 u+ K- v" R0 M F8 l/ w e0 ]3 F
<span>{lang comment_message1} <strong id="checklen">80</strong> {lang comment_message2}</span>
; ]6 H% t) _0 R' e$ ]* E9 K
' X1 _, t/ d6 _/ ~7 w
將紅色數字80改為160,第二個80可改可不改
0 s- I* I$ @ ^7 E2 h0 C/ s/ C8 E
==========================================================
# r" ]! J& s7 ?+ a# H
四,修改function驗證提示:
" w5 Z6 l1 y$ g; J/ n6 ]
source/function/function_post.php的361-363行:
5 [5 V5 i: s6 F; C4 v
修改前
+ U6 H" l8 h+ }: q4 ?% T8 `3 v1 H3 f& }
if(dstrlen($subject) > 80) {
- W! k. d0 [ ]# k$ ~3 {9 I! c
return 'post_subject_toolong';
* Q! ^6 L# w! j5 q
}
/ e5 ]# \* p c/ V- p- j: R! J
將數字80改為160
: n' P6 R4 [. Q9 G4 Q
==========================================================
: z1 D# q' o! F/ N B
五、找到訊息提示文字的php檔,打開 source/language/lang_messege.php 找到998行改為:
* w! Y3 Z" m- J/ w5 W4 _& ~5 h
'post_subject_toolong' => '抱歉,您的標題超過 160 個字符修改標題長度',
8 ]# s; |! G" v1 c
==========================================================
$ Z& h% U) C; N. O
上面五個步驟完成記得最後最重要的一個步驟是到後台更新緩存才會生效喔
$ b2 z: y0 T) S/ A3 l- f
歡迎光臨 52AV手機A片王|52AV.ONE (https://www.52av.one/)
Powered by Discuz! X3.2