52AV手機A片王|52AV.ONE

標題: 讓某頁面(如discuz.htm)專屬顯示(嵌入點=hooke鉤子)的插件應用在其他類的頁面(如forumdisplay_list.htm) [打印本頁]

作者: IT_man    時間: 2018-7-23 23:24
標題: 讓某頁面(如discuz.htm)專屬顯示(嵌入點=hooke鉤子)的插件應用在其他類的頁面(如forumdisplay_list.htm)
本帖最後由 IT_man 於 2018-7-23 23:28 編輯 8 y5 t& x9 [4 ^) ~! i' O; U; Z
5 }/ u2 o+ i, c
當我們安裝完插件時(此處以柒瑞首頁四格為例),它只能顯示在某類的頁面(此處是discuz.htm論壇首頁),此篇將教您如何應用到別類的頁面(此處以forumdisplay_list.htm帖子列表以及viewthread.htm帖子內容頂部為例)4 S, m$ D& A( d( L2 D  W+ _
0 L% x' ?0 i% r* z0 q
安裝完柒瑞首頁四格插件時,於前台驗證確實只顯示在論壇首頁discuz.htm,如今我們為了增加某些帖子的曝光度,企圖將柒瑞首頁四格插件顯示在帖子列表forumdisplay_list.htm以及帖子內容頂部viewthread.htm,意思等同於增加嵌入點(hooks鉤子)在forumdisplay_list.htm跟viewthread.htm.
, C( S$ _: T2 }1 K) G9 a
8 O. N  d, a2 u7 }  }3 j但是Discuz每一類的頁面都有其內定的插件嵌入點名稱(可以查google關鍵字"discuz嵌入點列表"),有些嵌入點名稱可以適用好幾類的頁面,但是大部分只能單獨顯示在自有的頁面.
/ e5 Z5 f0 O2 F' M# x8 c: R# T, L; S) R0 y, p; K3 |
經我查詢的結果:我所安裝的柒瑞首頁四格插件是顯示在discuz.htm,其嵌入點名稱是index_top;亦即在discuz.htm有一行code ===>
9 ?: ]6 j- C% S# j' C- X# x, N4 c3 m, N7 P<!--{hook/index_top}-->3 ^, ]5 A, N" B/ B

; i, q0 W/ o% O& e% u而在forumdisplay_list.htm有一個嵌入點名稱forumdisplay_threadlist_bottom(也可以選其他嵌入點名稱)是顯示在帖子列表的底部,我想顯示在頂部,於是我將 <!--{hook/forumdisplay_threadlist_bottom}--> 這段code移到forumdisplay_list.htm的最前面,在此同時,找到柒瑞首頁四格插件安裝的所在目錄 /source/plugin/toplist_7free/下的檔案toplist_7free.class.php內的函式 :
! j! d% |6 Q: h4 ?) J7 x% c5 D/ n1 N3 ^/ o0 v: b
function index_top() { }' E, p& A7 A* d, \( M

1 @+ K8 L6 F5 }; u$ Y" I  x將其整段複製到新的函式名稱 :
- o3 M) e0 l/ B0 S; x5 ~
5 M* ?) A. h' ?. g! `: kfunction forumdisplay_threadlist_bottom() { }
4 `. W- H! ~7 _+ _# h8 R
8 R; Q2 P5 k- a5 i' V5 ]) D同理,將其類推到viewthread.htm內的嵌入點名稱viewthread_top,再次將oplist_7free.class.php內的函式4 \( d+ m' V2 ~
* F$ z" Z0 }  e* T
function index_top() { }
! a3 U5 X* }  u
8 ?+ I9 o0 [1 z1 C+ R) t" `! K7 m

1 K. i& K: [+ d3 b' T  _, E! F整段複製到新的函式名稱 :% `* f2 F- p+ p/ S3 U+ |  e
function viewthread_top() { }
4 ?: S- \/ q8 S1 H* b記得存檔toplist_7free.class.php,同時更新後台==>工具==>更新 數據緩存 模板緩存% }  n1 h: T- W+ x4 A3 r/ f

# \. M+ I% I8 W: z9 L




歡迎光臨 52AV手機A片王|52AV.ONE (https://www.itech.casa/) Powered by Discuz! X3.2