Emlog文章页加入新的参数并写入数据库-站长杂谈下载

Emlog文章页加入新的参数并写入数据库

开通本站Svip会员,全站资源免费下
第一步:在根目录文件admin/views/add_log.php对应的位置加入你要的参数代码,例如:
  1. <div style="clear:both;">参数一:<input type="text" value="" name="sheli01" id="sheli01" style="width:750px;" /></div>
复制代码
第二步:在根目录文件admin/views/edit_log.php中对应的位置也加入你要的参数代码,例如:
  1. <div style="clear:both;">参数一:<input type="text" value="<?php echo $sheli01;?>" name="tkurl" id="sheli01" style="width:750px;" /></div>
复制代码
第三步:在根目录文件admin/save_log.php中
  1. $password = isset($_POST['password']) ? addslashes(trim($_POST['password'])) : '';" Y+ \. T" H4 X) l& V# I  j! \) `/ v
  2. 下面插入代码# o( i, o8 J3 t0 Q
  3. $sheli01= isset($_POST['sheli01']) ? addslashes(trim($_POST['sheli01'])) : '';
复制代码
  1. 'password' => $password,6 Q9 ~9 ]- F/ s  c
  2. 下面插入代码
    % `, K7 e- V5 s
  3. 'sheli01' => $sheli01,
复制代码
以上参数中的“sheli01”可以自行修改,只要统一就好。然后在数据库表emlog_blog中加入函数sheli01这样就搞定了。+ p, ~5 w) D% _
以上步骤全部完成就可以实现添加参数了,不过美中不足的是只有点击《保存并返回》才能保存。如想实现点击《保存》也能实现保存的话,请按下面的方法,找到根目录admin/views/js/common.js中找到
  1.             editorMap['content'].sync();
    + \" a: Q+ B8 ~. _* g
  2.             editorMap['excerpt'].sync();6 w! c0 v3 X2 r9 W
  3.                 var url = "save_log.php?action=autosave";) c5 T: X( j& j) L
  4.                 var title = $.trim($("#title").val());
    ( _: w  x0 h4 I
  5.                 var alias = $.trim($("#alias").val());
    2 i' m1 G4 d1 S0 k2 G* `" E
  6.                 var sort = $.trim($("#sort").val());0 k7 n+ I2 A; d( c% C& Q) k
  7.                 var postdate = $.trim($("#postdate").val());1 J% }! d1 V" d4 y
  8.                 var date = $.trim($("#date").val());4 h) Z; b. c) w; ~8 ^
  9.                 var logid = $("#as_logid").val();
    8 X4 O/ P1 n/ g, K1 b! S1 R
  10.                 var author = $("#author").val();
    ; K5 e3 w4 s3 n  A; W# o6 o" s, t
  11.                 var content = $('#content').val();
    : q- y& E/ N4 }
  12.                 var excerpt = $('#excerpt').val();  X! i8 N( O. L+ w- e
  13.                 var TAG = $.trim($("#tag").val());& A+ ]6 g5 j4 m: r
  14.                 var top = $("#post_options #top").attr("checked") == 'checked' ? 'y' : 'n';
    5 e: S8 o; b  K  S4 D
  15.                 var sortop = $("#post_options #sortop").attr("checked") == 'checked' ? 'y' : 'n';% d6 [+ x# ]) ]. t
  16.                 var allow_remark = $("#post_options #allow_remark").attr("checked") == 'checked' ? 'y' : 'n';  n$ w0 D3 A  L, G- B1 ], |  H
  17.                 var allow_tb = $("#post_options #allow_tb").attr("checked") == 'checked' ? 'y' : 'n';
    4 g, g2 m# k1 K+ T* d
  18.                 var password = $.trim($("#password").val());$ }+ N4 T! t) r& {! v. W" U
  19.                 var ishide = $.trim($("#ishide").val());* |2 W- j) N4 h; G
  20.         var token = $.trim($("#token").val());
    / n, W/ l' n0 p! C5 }
  21.                 var ishide = ishide == "" ? "y" : ishide;+ J2 W* v) Y6 N" f7 @
  22.                 var querystr = "content="+encodeURIComponent(content)' Z- D) ]. |! u. y1 ]5 w9 I
  23.                                         +"&excerpt="+encodeURIComponent(excerpt), N: [" X. E+ g1 ?7 b$ t
  24.                                         +"&title="+encodeURIComponent(title)3 U2 |- i9 S$ P4 N
  25.                                         +"&alias="+encodeURIComponent(alias)1 T4 _/ }' ?7 h/ B" F! }% s
  26.                                         +"&author="+author1 N' \$ e$ W9 _4 x. m: M4 C7 K! ]
  27.                                         +"&sort="+sort
    % g7 Q' `9 z# \/ Y4 w  R% t
  28.                                         +"&postdate="+postdate, t& S. z! t) G" s/ `; T: u8 E4 ~. [
  29.                                         +"&date="+date
    : x4 r- I6 P: g( y  |
  30.                                         +"&tag="+encodeURIComponent(tag): y! s% l4 ]6 a8 ~% I3 E
  31.                                         +"&top="+top
      y: e& z, K4 i+ x) v
  32.                                         +"&sortop="+sortop
    , {3 M7 t0 @, Y
  33.                                         +"&allow_remark="+allow_remark: R$ m, ~7 o. G- M# P$ Q6 L; F3 A
  34.                                         +"&allow_tb="+allow_tb
    ) Z6 V( U) G9 k' j2 S
  35.                                         +"&password="+password
    & }8 n. o; z4 K% D4 O
  36.                     +"&token="+token, q' H! l  E( I- n
  37.                                         +"&ishide="+ishide
    4 h7 W& W2 E, h; ], `, O
  38.                                         +"&as_logid="+logid;
复制代码
用下面的代码替换
  1.             editorMap['content'].sync();: u/ J2 t2 [$ u
  2.             editorMap['excerpt'].sync();4 g. r" O# H7 G- Q' d5 h
  3.                 var url = "save_log.php?action=autosave";' V  G; Z: ~6 F0 E% Z
  4.                 var title = $.trim($("#title").val());
    6 ^5 q; a5 e/ x/ y; r' r
  5.                 var alias = $.trim($("#alias").val());$ U/ x9 h8 h" i& m0 K
  6.                 var sort = $.trim($("#sort").val());
    - L4 G- r* M# Y' Q
  7.                 var postdate = $.trim($("#postdate").val());
    1 A( c- ~3 K" r* @+ B
  8.                 var date = $.trim($("#date").val());
    & ^* a3 {0 i3 n. _+ V' k5 @
  9.                 var logid = $("#as_logid").val();
    " T6 p+ v4 c' `0 _. {
  10.                 var author = $("#author").val();
    2 ^2 S; P9 ^3 `" B4 e
  11.                 var content = $('#content').val();
    - a- U& ^2 r; w! E/ n' f
  12.                 var excerpt = $('#excerpt').val();
    8 L  c( R9 G. F/ K
  13.                 var tag = $.trim($("#tag").val());
    / G7 L$ z6 i2 d- ?2 `4 y* z# h
  14.                 var top = $("#post_options #top").attr("checked") == 'checked' ? 'y' : 'n';1 l% |2 e. R4 m! p' R1 b" S( g
  15.                 var sortop = $("#post_options #sortop").attr("checked") == 'checked' ? 'y' : 'n';& \" k$ j; t2 W0 J
  16.                 var allow_remark = $("#post_options #allow_remark").attr("checked") == 'checked' ? 'y' : 'n';7 j* ~* m* o' C6 X8 {( Z# n- y5 S: Q
  17.                 var allow_tb = $("#post_options #allow_tb").attr("checked") == 'checked' ? 'y' : 'n';
    3 f4 i, O  p: f/ F
  18.                 var password = $.trim($("#password").val());
    + R- u$ j9 n& q+ P0 k, D. B
  19.                 var sheli01 = $.trim($("#sheli01").val()); //新加代码: F2 A# @0 y6 _! E4 e
  20.                 var ishide = $.trim($("#ishide").val());
    : i. `/ k* f6 h& j% V
  21.         var token = $.trim($("#token").val());
    9 [; {2 k; Q0 C8 [5 O. g
  22.                 var ishide = ishide == "" ? "y" : ishide;- t6 j  B9 _5 g0 v" Q6 q
  23.                 var querystr = "content="+encodeURIComponent(content)5 T9 Z' b) W5 y( G& C) G. P0 }
  24.                                         +"&excerpt="+encodeURIComponent(excerpt)
    ! U$ W* n% o& {
  25.                                         +"&title="+encodeURIComponent(title)  k' X6 t+ O  S: h2 f0 b: S
  26.                                         +"&alias="+encodeURIComponent(alias)" k! X4 F' j- s' l, ~2 W' {
  27.                                         +"&author="+author
    8 C$ U8 X2 s( u& o1 C
  28.                                         +"&sort="+sort7 P5 ~7 {6 B9 g2 q' {) s
  29.                                         +"&postdate="+postdate
    5 ?' R$ ?! T* ?% ^1 `% [
  30.                                         +"&date="+date
    5 L% D: A0 Y; C, a5 k4 K! \
  31.                                         +"&tag="+encodeURIComponent(tag)8 f3 C& Q2 o1 X$ m: b  U! y
  32.                                         +"&top="+top  a9 K1 |9 z$ W7 m$ ?! A
  33.                                         +"&sortop="+sortop/ m/ ^6 G" Q6 H: v3 e" b3 Z1 g
  34.                                         +"&allow_remark="+allow_remark4 H: J7 c' B4 u5 D: ?2 @& N
  35.                                         +"&allow_tb="+allow_tb
    ; m) O. ^7 l9 @4 H$ E7 D5 X
  36.                                         +"&password="+password
    + f3 b  ]/ l$ @5 p% ^1 N
  37.                                         +"&sheli01="+sheli01 //新加代码9 ]6 L' }/ e5 z7 W
  38.                     +"&token="+token
    " B* Y% [1 E. ]  n' I
  39.                                         +"&ishide="+ishide  ^- K- H2 C, V6 \( A9 ^3 r
  40.                                         +"&as_logid="+logid;
复制代码
动手试试吧,如有疑问,请在本页留言。/ Q- S8 T, u* L1 E) j5 z

全部评论 0

您需要登录后才可以回帖 立即登录
登录
0
0
0
返回顶部