久久久久av_欧美日韩一区二区在线_国产精品三区四区_日韩中字在线
Discuz! 官方交流社區
標題:
關于前端鉤子 按鈕顯示的問題 大佬們幫我看看 哪個地方有有問題
[打印本頁]
作者:
bug八阿哥
時間:
2024-9-8 00:35
標題:
關于前端鉤子 按鈕顯示的問題 大佬們幫我看看 哪個地方有有問題
關于前端鉤子 按鈕顯示的問題 大佬們幫我看看 哪個地方有問題
最終想顯示的是
發帖框頂部 發帖框中部 發帖框底部 還有 帖子和列表頁的 快速回復區域顯示
xml文件里面的代碼
<item id="hooks">
<item id="post_top">
<item id="qier_thread_top"><![CDATA[qier_thread_post_top]]></item>
</item>
<item id="post_middle">
<item id="qier_thread_middle"><![CDATA[qier_thread_post_middle]]></item>
</item>
<item id="post_bottom">
<item id="qier_thread_button"><![CDATA[qier_thread_post_button]]></item>
</item>
<item id="viewthread_fastpost_content">
<item id="qier_thread_viewthread_fastpost_content"><![CDATA[qier_thread_viewthread_fastpost_content]]></item>
</item>
<item id="forumdisplay_postbutton_bottom">
<item id="qier_thread_forumdisplay_postbutton_bottom"><![CDATA[qier_thread_forumdisplay_postbutton_bottom]]></item>
</item>
</item>
復制代碼
class.php里面的代碼
<?php
if(!defined('IN_DISCUZ')) {
exit('Access Denied');
}
class plugin_qier_thread {
public function post_top() {
if (!$this->is_plugin_enabled()) return '';
return $this->qier_thread_button('post_top');
}
public function post_middle() {
if (!$this->is_plugin_enabled()) return '';
return $this->qier_thread_button('post_middle');
}
public function post_bottom() {
if (!$this->is_plugin_enabled()) return '';
return $this->qier_thread_button('post_bottom');
}
public function viewthread_fastpost_content() {
if (!$this->is_plugin_enabled()) return '';
global $_G;
if($_G['cache']['plugin']['qier_thread']['show_in_fastpost']) {
return $this->_get_button_html();
}
return '';
}
public function global_header() {
if (!$this->is_plugin_enabled()) return;
global $_G;
$button_position = $this->get_button_position();
$button_text = $_G['cache']['plugin']['qier_thread']['custom_button_text'] ?: lang('plugin/qier_thread', 'qier_thread_generate_article');
// 只在發帖頁面顯示按鈕
if(CURSCRIPT == 'forum' && (CURMODULE == 'post' || CURMODULE == 'viewthread')) {
include template('qier_thread:qier_thread_post');
}
}
public function forumdisplay_postbutton_bottom() {
if (!$this->is_plugin_enabled()) return '';
global $_G;
if($_G['cache']['plugin']['qier_thread']['show_in_fastpost']) {
return $this->_get_button_html();
}
return '';
}
private function qier_thread_button($position) {
global $_G;
$enable = $_G['cache']['plugin']['qier_thread']['enable'];
$button_position = $_G['cache']['plugin']['qier_thread']['button_position'];
if (!$enable) {
return '';
}
$position_map = [
'post_top' => '1',
'post_middle' => '2',
'post_bottom' => '3'
];
if ($button_position !== $position_map[$position]) {
return '';
}
return $this->get_button_html();
}
private function _get_button_html() {
global $_G;
$button_text = $_G['cache']['plugin']['qier_thread']['custom_button_text'] ?: '這是個按鈕';
include template('qier_thread:button');
return $return;
}
private function get_button_html() {
$css_url = 'source/plugin/qier_thread/static/css/style.css';
$js_url = 'source/plugin/qier_thread/static/js/qier_thread.js';
$output = '<link rel="stylesheet" type="text/css" href="' . $css_url . '" />';
$output .= '<script type="text/javascript" src="' . $js_url . '"></script>';
$button = '<button type="button" id="qier_thread_button" class="qier-thread-button">';
$button .= '<span class="qier-thread-icon"></span>';
$button .= '<span class="qier-thread-text">' . $button_text . '</span>';
$button .= '</button>';
return $output . $button;
}
private function get_position_for_hook($hook) {
switch ($hook) {
case 'post_top': return 1;
case 'post_middle': return 2;
case 'post_bottom': return 3;
default: return 0;
}
}
public function get_button_position() {
global $_G;
return $_G['cache']['plugin']['qier_thread']['button_position'];
}
private function is_plugin_enabled() {
global $_G;
return !empty($_G['cache']['plugin']['qier_thread']['enable']);
}
}
復制代碼
試過好多方案 就是不能正常的顯示出按鈕 查看網頁源代碼 也沒用相關插件的js或者css文件路徑
也就是說沒啟動插件
不知道什么原因【上面的代碼是改了好幾種方案的其中一種了 都不顯示】
日志全開 日志頁抓不到。
作者:
myboss
時間:
2024-9-15 08:40
綜合法務服務,這個網站,我看看唄
歡迎光臨 Discuz! 官方交流社區 (http://www.9999xn.com/)
Powered by Discuz! W1.0