52AV手機A片王|52AV.ONE
標題:
discuz x3.2 標題字符從80改成160的方法
[打印本頁]
作者:
IT_man
時間:
2015-1-21 10:13
標題:
discuz x3.2 標題字符從80改成160的方法
==========================================================
, |1 V! k) W( K0 G1 V* p
一、database修改,標題字數(英文字1Byte,中文2Bytes)為160字符:執行sql command:
6 N* u& e7 k/ x& d
(注意改為你的表前缀)
3 ^0 U0 ]+ z2 s4 a8 n
ALTER TABLE `pre_forum_post` CHANGE `subject` `subject` VARCHAR(120) NOT NULL;
& P6 O5 @# O |% a `9 p/ v# ^/ d* F
ALTER TABLE `pre_forum_rsscache` CHANGE `subject` `subject` char(120) NOT NULL;
, q* o3 d% G) Y
ALTER TABLE `pre_forum_thread` CHANGE `subject` `subject` char(120) NOT NULL;
7 y0 u$ d s' [) _
' W: Z7 S. R8 E' P
或用phpdbadmin更改也可以
6 _" C# x( s& s& b% j
==========================================================
. W# _6 H% p% E4 M6 `; x }# c8 G
二、修改JS驗證字符數:
2 l, y, [6 |$ \" S2 i# {
1、找到 static/js/forum_post.js的74-80行
% ~0 Z$ j+ L: M
if(($('postsubmit').name != 'replysubmit' && !($('postsubmit').name == 'editsubmit' && !isfirstpost) && theform.subject.value == "") || !sortid && !special && trim(message) == "") {
) m6 U6 Q) ^- V. |# ]% C4 T4 i) `# B
showError('抱歉,您尚未輸入標題或內容);
2 q' C& t2 i+ ~8 y5 n
return false;
8 G. w; [ y0 P& E* |; z
} else if(mb_strlen(theform.subject.value) > 80) {
7 N4 z% G7 ?/ k6 f6 H7 b8 I) O
showError('您的標題超過 80 個字符的限制');
5 b% h# h8 {/ ]- c8 l7 I
return false;
2 L5 y; c6 W! m% E+ d
}
2 O j& I7 H9 }5 k, P- s o
- ]) o! N! s: \& c
數字80改為160
. Y' v8 v2 e5 F( m$ E& x
==========================================================
4 E6 ]$ D2 Y6 e2 m; `, Z9 W
2、找到 sitatic/js/forum.js的209到215行:
# H7 v4 c- i; W. C( i4 |
if(theform.message.value == '' && theform.subject.value == '') {
$ l5 Y9 s# V) q
s = '抱歉,您尚未輸入標題或內容';
8 ~1 Q, X. V4 U( P1 x! E- Z
theform.message.focus();
: O; e% \! Z4 f6 x
} else if(mb_strlen(theform.subject.value) > 80) {
- S3 a3 p1 v3 h, H# h' ?! w& j
s = '您的標題超過 80 個字符的限制';
# `! i0 F* f1 m" Q7 O
theform.subject.focus();
! M3 u6 P. P6 N p% _. |, \2 y8 g
}
7 a8 w! d9 ]& E! N0 d* I
( J; g' u: s" ^
" i1 D4 k* l# e- `
數字80改為160
7 j2 N/ h4 }' T8 G# C7 V( _' f
==========================================================
9 H6 a5 f+ H3 K! }" Q5 Y! [
三、修改模板中寫死的字數限制:
. j# x4 w- S1 W' X
1、找到 template\default\forum\post_editor_extra.htm第25行開始
6 V( ]6 U; t( h4 n) v$ U: P
修改前
7 l6 h" ]% m& T6 K9 X7 C. ~: D
<!--{if $_GET[action] != 'reply'}--
2 k/ W! k3 u1 g p' o4 Y
<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 f7 P, i W; U; n( f# n$ R& x
<!--{else}--><!--reply-->
% c! b7 E) q6 ]7 [2 c6 u
<span id="subjecthide" class="z">RE: $thread[subject] [<a href="javascript:;"#ff0000">80);return false;">{lang modify}</a>]</span>
' c* U6 `2 {2 h6 q0 K- S
<span id="subjectbox" style="display:none"><input type="text" name="subject" id="subject" class="px" value=""#ff0000">80);" style="width: 25em" /></span>
# \) ]4 G8 D/ g+ V8 W* I
<!--{/if}-->
9 K" A. A/ k2 |3 q9 ]9 N
<span id="subjectchk"{if $_GET[action] == 'reply'} style="display:none"{/if}>{lang comment_message1} <strong id="checklen">80</strong> {lang comment_message2}</span>
7 r$ V, e0 K& R' d- {1 W
<script type="text/javascript">strLenCalc($('subject'), 'checklen',
80
)</script>
$ _4 P0 b8 Y3 o9 {
0 [* J+ g& g. Q3 D; W% S
將紅色數字改為160
6 M3 k0 m$ P5 _9 d9 q* t6 _* g
==========================================================
& i* O4 _0 V& z; A8 B
2.找到 template\default\forum\forumdisplay_fastpost.htm 地31行開始
# r2 k2 R7 T' n' z3 y7 l* ~
修改前
9 j0 E% D& }' ] u; S
<input type="text" id="subject" name="subject" class="px" value=""#ff0000">80);" tabindex="11" style="width: 25em" />
5 \5 S( h% C8 a$ c: Q
<span>{lang comment_message1} <strong id="checklen">80</strong> {lang comment_message2}</span>
( G0 k7 b' r5 K
/ K0 Q/ S7 H0 S& n/ \% J
將紅色數字80改為160,第二個80可改可不改
$ ~0 \8 F! G y/ W3 ~) W) A
==========================================================
! w, L! n5 X/ m4 u4 O
四,修改function驗證提示:
+ u2 F- I) _' m+ a+ F
source/function/function_post.php的361-363行:
% T0 I0 b D, V. V7 C% i: Q
修改前
& P& i, ]; _. T
if(dstrlen($subject) > 80) {
: d M2 g! q- w$ O; P
return 'post_subject_toolong';
- S6 D4 _) ^, |" G; p
}
; {- v" c' P+ K( s1 L' |
將數字80改為160
& ?& m5 [; r+ o' k& H/ a; c4 U
==========================================================
3 f/ |! R1 U1 E: a
五、找到訊息提示文字的php檔,打開 source/language/lang_messege.php 找到998行改為:
, s4 U# L% z# {1 b
'post_subject_toolong' => '抱歉,您的標題超過 160 個字符修改標題長度',
6 K" E$ _/ w4 ?7 e7 I% x0 w, p
==========================================================
- k- c2 A! f& l" r) o
上面五個步驟完成記得最後最重要的一個步驟是到後台更新緩存才會生效喔
7 W/ n$ q; H' y+ A" I
歡迎光臨 52AV手機A片王|52AV.ONE (https://www.52av.one/)
Powered by Discuz! X3.2