52AV手機A片王|52AV.ONE
標題:
discuz x3.2 標題字符從80改成160的方法
[打印本頁]
作者:
IT_man
時間:
2015-1-21 10:13
標題:
discuz x3.2 標題字符從80改成160的方法
==========================================================
( s, x4 r- L! a: B2 V3 ^3 `9 B
一、database修改,標題字數(英文字1Byte,中文2Bytes)為160字符:執行sql command:
, T3 B) m% r4 Y
(注意改為你的表前缀)
- ^# f9 O* Q* s3 n' A' M$ J. G9 F
ALTER TABLE `pre_forum_post` CHANGE `subject` `subject` VARCHAR(120) NOT NULL;
0 L, u! q3 g1 [. r- @/ [
ALTER TABLE `pre_forum_rsscache` CHANGE `subject` `subject` char(120) NOT NULL;
1 M7 ?8 N" u, _% R% r- v
ALTER TABLE `pre_forum_thread` CHANGE `subject` `subject` char(120) NOT NULL;
1 ]7 F, V; C6 ?* F) Y
% k2 [! b; o& ~4 }8 s
或用phpdbadmin更改也可以
4 Z% M( x2 f' f+ X
==========================================================
3 l) @( ^, e. U4 S+ \7 {0 w
二、修改JS驗證字符數:
4 {" f$ ? s! u9 x; T3 @8 e1 ]9 l; }
1、找到 static/js/forum_post.js的74-80行
1 {% O, t4 R, Z/ e; e5 b' d, W, n
if(($('postsubmit').name != 'replysubmit' && !($('postsubmit').name == 'editsubmit' && !isfirstpost) && theform.subject.value == "") || !sortid && !special && trim(message) == "") {
+ V3 R. U7 |2 o( Q
showError('抱歉,您尚未輸入標題或內容);
6 [5 \$ z. x) V& p* ?3 _
return false;
, s( i0 \$ y) G' @, j
} else if(mb_strlen(theform.subject.value) > 80) {
. ^1 F! L0 L% D3 z( A7 I" h
showError('您的標題超過 80 個字符的限制');
4 T- M- u$ U) ]% U& r2 P2 e- E
return false;
* c! @/ l$ L2 O5 w: `9 S& W
}
% |( S% O! [& u! z
. l! B Q# P' @2 ?' j- W4 A% o+ L% C
數字80改為160
2 `/ o: i: s0 y$ A
==========================================================
" K; K! ?6 Y) w: v; ?" W
2、找到 sitatic/js/forum.js的209到215行:
" {% U) ?; ^4 _. l9 c; Y
if(theform.message.value == '' && theform.subject.value == '') {
1 U3 z3 u: A0 `8 i! |- s2 w1 [
s = '抱歉,您尚未輸入標題或內容';
" Q9 N$ A0 {& @: M' c& P, }
theform.message.focus();
9 [- P/ B* |2 C: t/ I6 g8 Y
} else if(mb_strlen(theform.subject.value) > 80) {
! l2 A+ I9 U4 p5 e. D2 k
s = '您的標題超過 80 個字符的限制';
5 p; Z& R) E- c+ c- W: k
theform.subject.focus();
& X0 Q2 m- s) R$ S9 _* \
}
6 F' Z5 j& k* |* b( ]6 s% W
7 ]: e6 _% a7 d7 u2 |+ w! \2 X
" G) A4 Y1 `: H7 l
數字80改為160
1 t- S2 A8 Q# k6 [% o
==========================================================
; U5 ^! j+ X1 [* d$ {
三、修改模板中寫死的字數限制:
6 S9 M4 w' {, w* H3 Y+ w4 Y& f$ d
1、找到 template\default\forum\post_editor_extra.htm第25行開始
/ D- J8 ]( L1 _, u3 O( z2 K6 a
修改前
- n2 u# I0 d9 R4 b0 W5 a( C
<!--{if $_GET[action] != 'reply'}--
( }! D/ s) P+ e
<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>
8 T ~: f4 H9 T( k6 R
<!--{else}--><!--reply-->
* A# y) W+ E- _! G" d" ]4 @
<span id="subjecthide" class="z">RE: $thread[subject] [<a href="javascript:;"#ff0000">80);return false;">{lang modify}</a>]</span>
t& U2 X/ F% E5 @6 L
<span id="subjectbox" style="display:none"><input type="text" name="subject" id="subject" class="px" value=""#ff0000">80);" style="width: 25em" /></span>
( F; ^. ?3 j1 b
<!--{/if}-->
, r) A7 m8 d9 |, w) ~0 `6 W/ l
<span id="subjectchk"{if $_GET[action] == 'reply'} style="display:none"{/if}>{lang comment_message1} <strong id="checklen">80</strong> {lang comment_message2}</span>
9 h! E* Q" p* G2 n E& F! ]( H
<script type="text/javascript">strLenCalc($('subject'), 'checklen',
80
)</script>
' D# \+ t3 Q$ N
4 |3 X6 ] K3 z& S
將紅色數字改為160
6 I O2 `) D& @6 c6 P& U: [
==========================================================
* M; W( c8 h" L6 L: @) J
2.找到 template\default\forum\forumdisplay_fastpost.htm 地31行開始
6 Y# Y1 n- Z9 D
修改前
# N7 {" z5 t: W' m9 P5 v1 g
<input type="text" id="subject" name="subject" class="px" value=""#ff0000">80);" tabindex="11" style="width: 25em" />
* ]8 }3 E& @& ?3 c) T
<span>{lang comment_message1} <strong id="checklen">80</strong> {lang comment_message2}</span>
8 C" w' e) t' J3 s
* J# u5 B5 \' e
將紅色數字80改為160,第二個80可改可不改
; q) K* ]/ t: G' \( v$ V
==========================================================
2 @% M H* a9 T/ s
四,修改function驗證提示:
% q4 p7 g4 O0 `& _! k
source/function/function_post.php的361-363行:
% R, \4 k" I7 ]( ?! Q* h" _$ C9 Q& _
修改前
$ \ Y+ n! z% z4 \
if(dstrlen($subject) > 80) {
) H/ l. _+ r9 ?# A; R0 Y. R9 M
return 'post_subject_toolong';
) W4 d+ ?* p; U* U/ Z2 @4 p; ?
}
4 p3 g( `8 _+ d, @+ o. C: P) W
將數字80改為160
8 o2 \" [: m% v2 c/ d4 T
==========================================================
: C, i& a9 w, e- w! _) E& W7 i6 n
五、找到訊息提示文字的php檔,打開 source/language/lang_messege.php 找到998行改為:
5 w, h- }4 ]9 h- A: u. `
'post_subject_toolong' => '抱歉,您的標題超過 160 個字符修改標題長度',
; Y0 ]! \! u2 U6 ?# V/ C
==========================================================
% s0 \3 s, y4 W& G+ X
上面五個步驟完成記得最後最重要的一個步驟是到後台更新緩存才會生效喔
]( ~/ \$ U* q) f3 J
歡迎光臨 52AV手機A片王|52AV.ONE (https://www.itech.casa/)
Powered by Discuz! X3.2