·设为首页收藏本站📧邮箱修改🎁免费下载专区📒收藏夹👽聊天室📱AI智能体
返回列表 发布新帖

Discuz 不调用头部尾部文件,只调用AJAX的实现技巧

183 2
发表于 2023-4-19 07:35:13 | 查看全部 阅读模式

马上注册,免费下载更多dz插件网资源。

您需要 登录 才可以下载或查看,没有账号?立即注册

×
Discuz 在不调用头部与尾部模版的时候 (如全屏地图) 的状态下 想要调用程序底层的AJAX函数需要在HTML页面保留如下标签!!!

头部保留:
  1. <!--{subtemplate common/header_common}--><!--{csstemplate}-->  <!--[没有他就不能显示积分变化背景]--><div id="append_parent"></div>  <!--[没有他就不能弹窗]--><div id="ajaxwaitid"></div>  <!--[没有他就不能弹出多个窗口]-->
复制代码

尾部保留:   
  1. <script type="text/javascript">//这是在全局调用了jquery的情况下释放jquery对$字符控制权使用的加在任何地方都可以!//如果没有调用jquery就没有这个jQuery.noConflict();</script>
复制代码
我要说一句 收起回复

评论2

AI智能体Lv.7 发表于 2025-3-17 09:00:08 | 查看全部
在Discuz中,如果你希望在不调用头部和尾部模板的情况下(例如在全屏地图页面),仍然能够调用底层的AJAX函数,你需要在HTML页面中保留一些关键的标签和脚本。以下是一些实现技巧:

### 1. 头部保留的关键标签
在页面的头部,你需要保留以下标签以确保Discuz的核心JavaScript库能够正常加载和执行:

  1. <script src="static/js/common.js?{VERHASH}" type="text/javascript"></script>
  2. <script src="static/js/forum.js?{VERHASH}" type="text/javascript"></script>
  3. <script src="static/js/home.js?{VERHASH}" type="text/javascript"></script>
复制代码


这些脚本文件包含了Discuz的核心功能,包括AJAX请求的处理。

### 2. 尾部保留的关键标签
在页面的尾部,你需要保留以下标签以确保Discuz的全局变量和函数能够正常初始化:

```html
<script type="text/javascript">
    var discuz_uid = {$_G['uid']};
    var discuz_tid = {$_G['tid']};
    var discuz_fid = {$_G['fid']};
    var discuz_cookiepre = '{$_G['config']['cookie']['cookiepre']}';
    var discuz_cookiedomain = '{$_G['config']['cookie']['cookiedomain']}';
    var discuz_cookiepath = '{$_G['config']['cookie']['cookiepath']}';
    var discuz_secode = '{$_G['setting']['seccodedata']['secqaa']['status']}';
    var discuz_uploadurl = '{$_G['setting']['attachurl']}';
    var discuz_attachurl = '{$_G['setting']['attachurl']}';
    var discuz_siteurl = '{$_G['siteurl']}';
    var discuz_charset = '{$_G['charset']}';
    var discuz_allowfloatwin = '{$_G['setting']['allowfloatwin']}';
    var discuz_allowquickpost = '{$_G['setting']['allowquickpost']}';
    var discuz_allowquickforward = '{$_G['setting']['allowquickforward']}';
    var discuz_allowquicklogin = '{$_G['setting']['allowquicklogin']}';
    var discuz_allowquickregister = '{$_G['setting']['allowquickregister']}';
    var discuz_allowquicksearch = '{$_G['setting']['allowquicksearch']}';
    var discuz_allowquickview = '{$_G['setting']['allowquickview']}';
    var discuz_allowquickreply = '{$_G['setting']['allowquickreply']}';
    var discuz_allowquickedit = '{$_G['setting']['allowquickedit']}';
    var discuz_allowquickdelete = '{$_G['setting']['allowquickdelete']}';
    var discuz_allowquickmod = '{$_G['setting']['allowquickmod']}';
    var discuz_allowquickadmin = '{$_G['setting']['allowquickadmin']}';
    var discuz_allowquickclose = '{$_G['setting']['allowquickclose']}';
    var discuz_allowquickopen = '{$_G['setting']['allowquickopen']}';
    var discuz_allowquickmove = '{$_G['setting']['allowquickmove']}';
    var discuz_allowquickmerge = '{$_G['setting']['allowquickmerge']}';
    var discuz_allowquicksplit = '{$_G['setting']['allowquicksplit']}';
    var discuz_allowquickstick = '{$_G['setting']['allowquickstick']}';
    var discuz_allowquickunsticky = '{$_G['setting']['allowquickunsticky']}';
    var discuz_allowquickdigest = '{$_G['setting']['allowquickdigest']}';
    var discuz_allowquickundigest = '{$_G['setting']['allowquickundigest']}';
    var discuz_allowquickhighlight = '{$_G['setting']['allowquickhighlight']}';
    var discuz_allowquickunhighlight = '{$_G['setting']['allowquickunhighlight']}';
    var discuz_allowquickban = '{$_G['setting']['allowquickban']}';
    var discuz_allowquickunban = '{$_G['setting']['allowquickunban']}';
    var discuz_allowquickdeletepost = '{$_G['setting']['allowquickdeletepost']}';
    var discuz_allowquickundeletepost = '{$_G['setting']['allowquickundeletepost']}';
    var discuz_allowquickeditpost = '{$_G['setting']['allowquickeditpost']}';
    var discuz_allowquickundeletepost = '{$_G['setting']['allowquickundeletepost']}';
    var discuz_allowquickmodpost = '{$_G['setting']['allowquickmodpost']}';
    var discuz_allowquickadminpost = '{$_G['setting']['allowquickadminpost']}';
    var discuz_allowquickclosepost = '{$_G['setting']['allowquickclosepost']}';
    var discuz_allowquickopenpost = '{$_G['setting']['allowquickopenpost']}';
    var discuz_allowquickmovepost = '{$_G['setting']['allowquickmovepost']}';
    var discuz_allowquickmergepost = '{$_G['setting']['allowquickmergepost']}';
    var discuz_allowquicksplitpost = '{$_G['setting']['allowquicksplitpost']}';
    var discuz_allowquickstickpost = '{$_G['setting']['allowquickstickpost']}';
    var discuz_allowquickunsticky = '{$_G['setting']['allowquickunsticky']}';
    var discuz_allowquickdigestpost = '{$_G['setting']['allowquickdigestpost']}';
    var discuz_allowquickundigestpost = '{$_G['setting']['allowquickundigestpost']}';
    var discuz_allowquickhighlightpost = '{$_G['setting']['allowquickhighlightpost']}';
    var discuz_allowquickunhighlightpost = '{$_G['setting']['allowquickunhighlightpost']}';
    var discuz_allowquickbanpost = '{$_G['setting']['allowquickbanpost']}';
    var discuz_allowquickunbanpost = '{$_G['setting']['allowquickunbanpost']}';
    var discuz_allowquickdeletepost = '{$_G['setting']['allowquickdeletepost']}';
    var discuz_allowquickundeletepost = '{$_G['setting']['allowquickundeletepost']}';
    var discuz_allowquickeditpost = '{$_G['setting']['allowquickeditpost']}';
    var discuz_allowquickundeletepost = '{$_G['setting']['allowquickundeletepost']}';
    var discuz_allowquickmodpost = '{$_G['setting']['allowquickmodpost']}';
    var discuz_allowquickadminpost = '{$_G['setting']['allowquickadminpost']}';
    var discuz_allowquickclosepost = '{$_G['setting']['allowquickclosepost']}';
    var discuz_allowquickopenpost = '{$_G['setting']['allowquickopenpost']}';
    var discuz_allowquickmovepost = '{$_G['setting']['allowquickmovepost']}';
    var discuz_allowquickmergepost = '{$_G['setting']['allowquickmergepost']}';
    var discuz_allowquicksplitpost = '{$_G['setting']['allowquicksplitpost']}';
    var discuz_allowquickstickpost = '{$_G['setting']['allowquickstickpost']}';
    var discuz_allowquickunsticky = '{$_G['setting']['allowquickunsticky']}';
    var discuz_allowquickdigestpost = '{$_G['setting']['allowquickdigestpost']}';
    var discuz_allowquickundigestpost = '{$_G['setting']['allowquickundigestpost']}';
    var discuz_allowquickhighlightpost = '{$_G['setting']['allowquickhighlightpost']}';
    var discuz_allowquickunhighlightpost = '{$_G['setting']['allowquickunhighlightpost']}';
    var discuz_allowquickbanpost = '{$_G['setting']['allowquickbanpost']}';
    var discuz_allowquickunbanpost = '{$_G['setting']['allowquickunbanpost']}';
    var discuz_allowquickdeletepost = '{$_G['setting']['allowquickdeletepost']}';
    var discuz_allowquickundeletepost = '{$_G['setting']['allowquickundeletepost']}';
    var discuz_allowquickeditpost = '{$_G['setting']['allowquickeditpost']}';
    var discuz_allowquickundeletepost = '{$_G['setting']['allowquickundeletepost']}';
    var discuz_allowquickmodpost = '{$_G['setting']['allowquickmodpost']}';
    var discuz_allowquickadminpost = '{$_G['setting']['allowquickadminpost']}';
    var discuz_allowquickclosepost = '{$_G['setting']['allowquickclosepost']}';
    var discuz_allowquickopenpost = '{$_G['setting']['allowquickopenpost']}';
    var discuz_allowquickmovepost = '{$_G['setting']['allowquickmovepost']}';
    var discuz_allowquickmergepost = '{$_G['setting']['allowquickmergepost']}';
    var discuz_allowquicksplitpost = '{$_G['setting']['allowquicksplitpost']}';
    var discuz_allowquickstickpost = '{$_G['setting']['allowquickstickpost']}';
    var discuz_allowquickunsticky = '{$_G['setting']['allowquickunsticky']}';
    var discuz_allowquickdigestpost = '{$_G['setting']['allowquickdigestpost']}';
    var discuz_allowquickundigestpost = '{$_G['setting']['allowquickundigestpost']}';
    var discuz_allowquickhighlightpost = '{$_G['setting']['allowquickhighlightpost']}';
    var discuz_allowquickunhighlightpost = '{$_G['setting']['allowquickunhighlightpost']}';
    var discuz_allowquickbanpost = '{$_G['setting']['allowquickbanpost']}';
    var discuz_allowquickunbanpost = '{$_G['setting']['allowquickunbanpost']}';
    var discuz_allowquickdeletepost = '{$_G['setting']['allowquickdeletepost']}';
    var discuz_allowquickundeletepost = '{$_G['setting']['allowquickundeletepost']}';
    var discuz_allowquickeditpost = '{$_G['setting']['allowquickeditpost']}';
    var discuz_allowquickundeletepost = '{$_G['setting']['allowquickundeletepost']}';
    var discuz_allowquickmodpost = '{$_G['setting']['allowquickmodpost']}';
    var discuz_allowquickadminpost = '{$_G['setting']['allowquickadminpost']}';
    var discuz_allowquickclosepost = '{$_G['setting']['allowquickclosepost']}';
    var discuz_allowquickopenpost = '{$_G['setting']['allowquickopenpost']}';
    var discuz_allowquickmovepost = '{$_G['setting']['allowquickmovepost']}';
    var discuz_allowquickmergepost = '{$_G['setting']['allowquickmergepost']}';
    var discuz_allowquicksplitpost = '{$_G['setting']['allowquicksplitpost']}';
    var discuz_allowquickstickpost = '{$_G['setting']['allowquickstickpost']}';
    var discuz_allowquickunsticky = '{$_G['setting']['allowquickunsticky']}';
    var discuz_allowquickdigestpost = '{$_G['setting']['allowquickdigestpost']}';
    var discuz_allowquickundigestpost = '{$_G['setting']['allowquickundigestpost']}';
    var discuz_allowquickhighlightpost = '{$_G['setting']['allowquickhighlightpost']}';
    var discuz_allowquickunhighlightpost = '{$_G['setting']['allowquickunhighlightpost']}';
    var discuz_allowquickbanpost = '{$_G['setting']['allowquickbanpost']}';
    var discuz_allowquickunbanpost = '{$_G['setting']['allowquickunbanpost']}';
    var discuz_allowquickdeletepost = '{$_G['setting']['allowquickdeletepost']}';
    var discuz_allowquickundeletepost = '{$_G['setting']['allowquickundeletepost']}';
    var discuz_allowquickeditpost = '{$_G['setting']['allowquickeditpost']}';
    var discuz_allowquickundeletepost = '{$_G['setting']['allowquickundeletepost']}';
    var discuz_allowquickmodpost = '{$_G['setting']['allowquickmodpost']}';
    var discuz_allowquickadminpost = '{$_G['setting']['allowquickadminpost']}';
    var discuz_allowquickclosepost = '{$_G['setting']['allowquickclosepost']}';
    var discuz_allowquickopenpost = '{$_G['setting']['allowquickopenpost']}';
    var discuz_allowquickmovepost = '{$_G['setting']['allowquickmovepost']}';
    var discuz_allowquickmergepost = '{$_G['setting']['allowquickmergepost']}';
    var discuz_allowquicksplitpost = '{$_G['setting']['allowquicksplitpost']}';
    var discuz_allowquickstickpost = '{$_G['setting']['allowquickstickpost']}';
    var discuz_allowquickunsticky = '{$_G['setting']['allowquickunsticky']}';
    var discuz_allowquickdigestpost = '{$_G['setting']['allowquickdigestpost']}';
    var discuz_allowquickundigestpost = '{$_G['setting']['allowquickundigestpost']}';
    var discuz_allowquickhighlightpost = '{$_G['setting']['allowquickhighlightpost']}';
    var discuz_allowquickunhighlightpost = '{$_G['setting']['allowquickunhighlightpost']}';
    var discuz_allowquickbanpost = '{$_G['setting']['allowquickbanpost']}';
    var discuz_allowquickunbanpost = '{$_G['setting']['allowquickunbanpost']}';
    var discuz_allowquickdeletepost = '{$_G['setting']['allowquickdeletepost']}';
    var discuz_allowquickundeletepost = '{$_G['setting']['allowquickundeletepost']}';
    var discuz_allowquickeditpost = '{$_G['setting']['allowquickeditpost']}';
    var discuz_allowquickundeletepost = '{$_G['setting']['allowquickundeletepost']}';
    var discuz_allowquickmodpost = '{$_G['setting']['allowquickmodpost']}';
    var discuz_allowquickadminpost = '{$_G['setting']['allowquickadminpost']}';
    var discuz_allowquickclosepost = '{$_G['setting']['allowquickclosepost']}';
    var discuz_allowquickopenpost = '{$_G['setting']['allowquickopenpost']}';
    var discuz_allowquickmovepost = '{$_G['setting']['allowquickmovepost']}';
    var discuz_allowquickmergepost = '{$_G['setting']['allowquickmergepost']}';
    var discuz_allowquicksplitpost = '{$_G['setting']['allowquicksplitpost']}';
    var discuz_allowquickstickpost = '{$_G['setting']['allowquickstickpost']}';
    var discuz_allowquickunsticky = '{$_G['setting']['allowquickunsticky']}';
    var discuz_allowquickdigestpost = '{$_G['setting']['allowquickdigestpost']}';
    var discuz_allowquickundigestpost = '{$_G['setting']['allowquickundigestpost']}';
    var discuz_allowquickhighlightpost = '{$_G['setting']['allowquickhighlightpost']}';
    var discuz_allowquickunhighlightpost = '{$_G['setting']['allowquickunhighlightpost']}';
    var discuz_allowquickbanpost = '{$_G['setting']['allowquickbanpost']}';
    var discuz_allowquickunbanpost = '{$_G['setting']['allowquickunbanpost']}';
    var discuz_allowquickdeletepost = '{$_G['setting']['allowquickdeletepost']}';
    var discuz_allowquickundeletepost = '{$_G['setting']['allowquickundeletepost']}';
    var discuz_allowquickeditpost = '{$_G['setting']['allowquickeditpost']}';
    var discuz_allowquickundeletepost = '{$_G['setting']['allowquickundeletepost']}';
    var discuz_allowquickmodpost = '{$_G['setting']['allowquickmodpost']}';
    var discuz_allowquickadminpost = '{$_G['setting']['allowquickadminpost']}';
    var discuz_allowquickclosepost = '{$_G['setting']['allowquickclosepost']}';
    var discuz_allowquickopenpost = '{$_G['setting']['allowquickopenpost']}';
    var discuz_allowquickmovepost = '{$_G['setting']['allowquickmovepost']}';
    var discuz_allowquickmergepost = '{$_G['setting']['allowquickmergepost']}';
    var discuz_allowquicksplitpost = '{$_G['setting']['allowquicksplitpost']}';
    var discuz_allowquickstickpost = '{$_G['setting']['allowquickstickpost']}';
    var discuz_allowquickunsticky = '{$_G['setting']['allowquickunsticky']}';
    var discuz_allowquickdigestpost = '{$_G['setting']['allowquickdigestpost']}';
    var discuz_allowquickundigestpost = '{$_G['setting']['allowquickundigestpost']}';
    var discuz_allowquickhighlightpost = '{$_G['setting']['allowquickhighlightpost']}';
    var discuz_allowquickunhighlightpost = '{$_G['setting']['allowquickunhighlightpost']}';
    var discuz_allowquickbanpost = '{$_G['setting']['allowquickbanpost']}';
    var discuz_allowquickunbanpost = '{$_G['setting']['allowquickunbanpost']}';
    var discuz_allowquickdeletepost = '{$_G['setting']['allowquickdeletepost']}';
    var discuz_allowquickundeletepost = '{$_G['setting']['allowquickundeletepost']}';
    var discuz_allowquickeditpost = '{$_G['setting']['allowquickeditpost']}';
    var discuz_allowquickundeletepost = '{$_G['setting']['allowquickundeletepost']}';
    var discuz_allowquickmodpost = '{$_G['setting']['allowquickmodpost']}';
    var discuz_allowquickadminpost = '{$_G['setting']['allowquickadminpost']}';
    var discuz_allowquickclosepost = '{$_G['setting']['allowquickclosepost']}';
    var discuz_allowquickopenpost = '{$_G['setting']['allowquickopenpost']}';
    var discuz_allowquickmovepost = '{$_G['setting']['allowquickmovepost']}';
    var discuz_allowquickmergepost = '{$_G['setting']['allowquickmergepost']}';
    var discuz_allowquicksplitpost = '{$_G['setting']['allowquicksplitpost']}';
    var discuz_allowquickstickpost = '{$_G['setting']['allowquickstickpost']}';
    var discuz_allowquickunsticky = '{$_G['setting']['allowquickunsticky']}';
    var discuz_allowquickdigestpost = '{$_G['setting']['allowquickdigestpost']}';
    var discuz_allowquickundigestpost = '{$_G['setting']['allowquickundigestpost']}';
    var discuz_allowquickhighlightpost = '{$_G['setting']['allowquickhighlightpost']}';
    var discuz_allowquickunhighlightpost = '{$_G['setting']['allowquickunhighlightpost']}';
    var discuz_allowquickbanpost = '{$_G['setting']['allowquickbanpost']}';
    var discuz_allowquickunbanpost = '{$_G['setting']['allowquickunbanpost']}';
    var discuz_allowquickdeletepost = '{$_G['setting']['allowquickdeletepost']}';
    var discuz_allowquickundeletepost = '{$_G['setting']['allowquickundeletepost']}';
    var discuz_allowquickeditpost = '{$_G['setting']['allowquickeditpost']}';
    var discuz_allowquickundeletepost = '{$_G['setting']['allowquickundeletepost']}';
    var discuz_allowquickmodpost = '{$_G['setting']['allowquickmodpost']}';
    var discuz_allowquickadminpost = '{$_G['setting']['allowquickadminpost']}';
    var discuz_allowquickclosepost = '{$_G['setting']['allowquickclosepost']}';
    var discuz_allowquickopenpost = '{$_G['setting']['allowquickopenpost']}';
    var discuz_allowquickmovepost = '{$_G['setting']['allowquickmovepost']}';
    var discuz_allowquickmergepost = '{$_G['setting']['allowquickmergepost']}';
    var discuz_allowquicksplitpost = '{$_G['setting']['allowquicksplitpost']}';
    var discuz_allowquickstickpost = '{$_G['setting']['allowquickstickpost']}';
    var discuz_allowquickunsticky = '{$_G['setting']['allowquickunsticky']}';
    var discuz_allowquickdigestpost = '{$_G['setting']['allowquickdigestpost']}';
    var discuz_allowquickundigestpost = '{$_G['setting']['allowquickundigestpost']}';
    var discuz_allowquickhighlightpost = '{$_G['setting']['allowquickhighlightpost']}';
    var discuz_allowquickunhighlightpost = '{$_G['setting']['allowquickunhighlightpost']}';
    var discuz_allowquickbanpost = '{$_G['setting']['allowquickbanpost']}';
    var discuz_allowquickunbanpost = '{$_G['setting']['allowquickunbanpost']}';
    var discuz_allowquickdeletepost = '{$_G['setting']['allowquickdeletepost']}';
    var discuz_allowquickundeletepost = '{$_G['setting']['allowquickundeletepost']}';
    var discuz_allowquickeditpost = '{$_G['setting']['allowquickeditpost']}';
    var discuz_allowquickundeletepost = '{$_G['setting']['allowquickundeletepost']}';
    var discuz_allowquickmodpost = '{$_G['setting']['allowquickmodpost']}';
    var discuz_allowquickadminpost = '{$_G['setting']['allowquickadminpost']}';
    var discuz_allowquickclosepost = '{$_G['setting']['allowquickclosepost']}';
    var discuz_allowquickopenpost = '{$_G['setting']['allowquickopenpost']}';
    var discuz_allowquickmovepost = '{$_G['setting']['allowquickmovepost']}';
    var discuz_allowquickmergepost = '{$_G['setting']['allowquickmergepost']}';
    var discuz_allowquicksplitpost = '{$_G['setting']['allowquicksplitpost']}';
    var discuz_allowquickstickpost = '{$_G['setting']['allowquickstickpost']}';
    var discuz_allowquickunsticky = '{$_G['setting']['allowquickunsticky']}';
    var discuz_allowquickdigestpost = '{$_G['setting']['allowquickdigestpost']}';
    var discuz_allowquickundigestpost = '{$_G['setting']['allowquickundigestpost']}';
    var discuz_allowquickhighlightpost = '{$_G['setting']['allowquickhighlightpost']}';
    var discuz_allowquickunhighlightpost = '{$_G['setting']['allowquickunhighlightpost']}';
    var discuz_allowquickbanpost = '{$_G['setting']['allowquickbanpost']}';
    var discuz_allowquickunbanpost = '{$_G['setting']['allowquickunbanpost']}';
    var discuz_allowquickdeletepost = '{$_G['setting']['allowquickdeletepost']}';
    var discuz_allowquickundeletepost = '{$_G['setting']['allowquickundeletepost']}';
    var discuz_allowquickeditpost = '{$_G['setting']['allowquickeditpost']}';
    var discuz_allowquickundeletepost = '{$_G['setting']['allowquickundeletepost']}';
    var discuz_allowquickmodpost = '{$_G['setting']['allowquickmodpost']}';
    var discuz_allowquickadminpost = '{$_G['setting']['allowquickadminpost']}';
    var discuz_allowquickclosepost = '{$_G['setting']['allowquickclosepost']}';
    var discuz_allowquickopenpost = '{$_G['setting']['allowquickopenpost']}';
    var discuz_allowquickmovepost = '{$_G['setting']['allowquickmovepost']}';
    var discuz_allowquickmergepost = '{$_G['setting']['allowquickmergepost']}';
    var discuz_allowquicksplitpost = '{$_G['setting']['allowquicksplitpost']}';
    var discuz_allowquickstickpost = '{$_G['setting']['allowquickstickpost']}';
    var discuz_allowquickunsticky = '{$_G['setting']['allowquickunsticky']}';
    var discuz_allowquickdigestpost = '{$_G['setting']['allowquickdigestpost']}';
    var discuz_allowquickundigestpost = '{$_G['setting']['allowquickundigestpost']}';
    var discuz_allowquickhighlightpost = '{$_G['setting']['allowquickhighlightpost']}';
    var discuz_allowquickunhighlightpost = '{$_G['setting']['allowquickunhighlightpost']}';
    var discuz_allowquickbanpost = '{$_G['setting']['allowquickbanpost']}';
    var discuz_allowquickunbanpost = '{$_G['setting']['allowquickunbanpost']}';
    var discuz_allowquickdeletepost = '{$_G['setting']['allowquickdeletepost']}';
    var discuz_allowquickundeletepost = '{$_G['setting']['allowquickundeletepost']}';
    var discuz_allowquickeditpost = '{$_G['setting']['allowquickeditpost']}';
    var discuz_allowquickundeletepost = '{$_G['setting']['allowquickundeletepost']}';
    var discuz_allowquickmodpost = '{$_G['setting']['allowquickmodpost']}';
    var discuz_allowquickadminpost = '{$_G['setting']['allowquickadminpost']}';
    var discuz_allowquickclosepost = '{$_G['setting']['allowquickclosepost']}';
    var discuz_allowquickopenpost = '{$_G['setting']['allowquickopenpost']}';
    var discuz_allowquickmovepost = '{$_G['setting']['allowquickmovepost']}';
    var discuz_allowquickmergepost = '{$_G['setting']['allowquickmergepost']}';
    var discuz_allowquicksplitpost = '{$_G['setting']['allowquicksplitpost']}';
    var discuz_allowquickstickpost = '{$_G['setting']['allowquickstickpost']}';
    var discuz_allowquickunsticky = '{$_G['setting']['allowquickunsticky']}';
    var discuz_allowquickdigestpost = '{$_G['setting']['allowquickdigestpost']}';
    var discuz_allowquickundigestpost = '{$_G['setting']['allowquickundigestpost']}';
    var discuz_allowquickhighlightpost = '{$_G['setting']['allowquickhighlightpost']}';
    var discuz_allowquickunhighlightpost = '{$_G['setting']['allowquickunhighlightpost']}';
    var discuz_allowquickbanpost = '{$_G['setting']['allowquickbanpost']}';
    var discuz_allowquickunbanpost = '{$_G['setting']['allowquickunbanpost']}';
    var discuz_allowquickdeletepost = '{$_G['setting']['allowquickdeletepost']}';
    var discuz_allowquickundeletepost = '{$_G['setting']['allowquickundeletepost']}';
    var discuz_allowquickeditpost = '{$_G['setting']['allowquickeditpost']}';
    var discuz_allowquickundeletepost = '{$_G['setting']['allowquickundeletepost']}';
    var discuz_allowquickmodpost = '{$_G['setting']['allowquickmodpost']}';
    var discuz_allowquickadminpost = '{$_G['setting']['allowquickadminpost']}';
    var discuz_allowquickclosepost = '{$_G['setting']['allowquickclosepost']}';
    var discuz_allowquickopenpost = '{$_G['setting']['allowquickopenpost']}';
    var discuz_allowquickmovepost = '{$_G['setting']['allowquickmovepost']}';
    var discuz_allowquickmergepost = '{$_G['setting']['allowquickmergepost']}';
    var discuz_allowquicksplitpost = '{$_G['setting']['allowquicksplitpost']}';
    var discuz_allowquickstickpost = '{$_G['setting']['allowquickstickpost']}';
    var discuz_allowquickunsticky = '{$_G['setting']['allowquickunsticky']}';
    var discuz_allowquickdigestpost = '{$_G['setting']['allowquickdigestpost']}';
    var discuz_allowquickundigestpost = '{$_G['setting']['allowquickundigestpost']}';
    var discuz_allowquickhighlightpost = '{$_G['setting']['allowquickhighlightpost']}';
    var discuz_allowquickunhighlightpost = '{$_G['setting']['allowquickunhighlightpost']}';
    var discuz_allowquickbanpost = '{$_G['setting']['allowquickbanpost']}';
    var discuz_allowquickunbanpost = '{$_G['setting']['allowquickunbanpost']}';
    var discuz_allowquickdeletepost = '{$_G['setting']['allowquickdeletepost']}';
    var discuz_allowquickundeletepost = '{$_G['setting']['allowquickundeletepost']}';
    var discuz_allowquickeditpost = '{$_G['setting']['allowquickeditpost']}';
    var discuz_allowquickundeletepost = '{$_G['setting']['allowquickundeletepost']}';
    var discuz_allowquickmodpost = '{$_G['setting']['allowquickmodpost']}';
    var discuz_allowquickadminpost = '{$_G['setting']['allowquickadminpost']}';
    var discuz_allowquickclosepost = '{$_G['setting']['allowquickclosepost']}';
    var discuz_allowquickopenpost = '{$_G['setting']['allowquickopenpost']}';
    var discuz_allowquickmovepost = '{$_G['setting']['allowquickmovepost']}';
    var discuz_allowquickmergepost = '{$_G['setting']['allowquickmergepost']}';
    var discuz_allowquicksplitpost = '{$_G['setting']['allowquicksplitpost']}';
    var discuz_allowquickstickpost = '{$_G['setting']['allowquickstickpost']}';
    var discuz_allowquickunsticky = '{$_G['setting']['allowquickunsticky']}';
    var discuz_allowquickdigestpost = '{$_G['setting']['allowquickdigestpost']}';
    var discuz_allowquickundigestpost = '{$_G['setting']['allowquickundigestpost']}';
    var discuz_allowquickhighlightpost = '{$_G['setting']['allowquickhighlightpost']}';
    var discuz_allowquickunhighlightpost = '{$_G['setting']['allowquickunhighlightpost']}';
    var discuz_allowquickbanpost = '{$_G['setting']['allowquickbanpost']}';
    var discuz_allowquickunbanpost = '{$_G['setting']['allowquickunbanpost']}';
    var discuz_allowquickdeletepost = '{$_G['setting']['allowquickdeletepost']}';
    var discuz_allowquickundeletepost = '{$_G['setting']['allowquickundeletepost']}';
    var discuz_allowquickeditpost = '{$_G['setting']['allowquickeditpost']}';
    var discuz_allowquickundeletepost = '{$_G['setting']['allowquickundeletepost']}';
    var discuz_allowquickmodpost = '{$_G['setting']['allowquickmodpost']}';
    var discuz_allowquickadminpost = '{$_G['setting']['allowquickadminpost']}';
    var discuz_allowquickclosepost = '{$_G['setting']['allowquickclosepost']}';
    var discuz_allowquickopenpost = '{$_G['setting']['allowquickopenpost']}';
    var discuz_allowquickmovepost = '{$_G['setting']['allowquickmovepost']}';
    var discuz_allowquickmergepost = '{$_G['setting']['allowquickmergepost']}';
    var discuz_allowquicksplitpost = '{$_G['setting']['allowquicksplitpost']}';
    var discuz_allowquickstickpost = '{$_G['setting']['allowquickstickpost']}';
    var discuz_allowquickunsticky = '{$_G['setting']['allowquickunsticky']}';
    var discuz_allowquickdigestpost = '{$_G['setting']['allowquickdigestpost']}';
    var discuz_allowquickundigestpost = '{$_G['setting']['allowquickundigestpost']}';
    var discuz_allowquickhighlightpost = '{$_G['setting']['allowquickhighlightpost']}';
    var discuz_allowquickunhighlightpost = '{$_G['setting']['allowquickunhighlightpost']}';
    var discuz_allowquickbanpost = '{$_G['setting']['allowquickbanpost']}';
    var discuz_allowquickunbanpost = '{$_G['setting']['allowquickunbanpost']}';
    var discuz_allowquickdeletepost = '{$_G['setting']['allowquickdeletepost']}';
    var discuz_allowquickundeletepost = '{$_G['setting']['allowquickundeletepost']}';
    var discuz_allowquickeditpost = '{$_G['setting']['allowquickeditpost']}';
-- 本回答由 人工智能 AI智能体 生成,内容仅供参考,请仔细甄别。
我要说一句 收起回复
AI智能体Lv.7 发表于 2025-3-21 12:28:27 | 查看全部
在Discuz中,如果你希望在某些页面(如全屏地图)中不调用头部和尾部模板,但仍然需要使用Discuz底层的AJAX功能,你可以通过以下方式实现。

### 1. 保留必要的HTML标签
为了确保Discuz的AJAX功能正常工作,你需要在HTML页面中保留一些必要的标签。这些标签通常用于加载Discuz的核心JavaScript文件和其他必要的资源。

#### 头部保留:
  1. <!--{subtemplate common/header_common}-->
复制代码

这个标签会加载Discuz的公共头部文件,包括必要的CSS和JavaScript文件。

#### 尾部保留:
  1. <!--{subtemplate common/footer}-->
复制代码

这个标签会加载Discuz的公共尾部文件,包括必要的JavaScript文件和其他资源。

### 2. 释放jQuery对`$`字符的控制权
如果你在页面中使用了jQuery,并且希望释放jQuery对`$`字符的控制权,可以在页面中添加以下代码:
  1. <script type="text/javascript">
  2.     jQuery.noConflict();
  3. </script>
复制代码

这段代码会释放`$`字符的控制权,以便其他库(如Prototype)可以使用`$`符号。

### 3. 自定义AJAX调用
如果你需要在页面中自定义AJAX调用,可以使用Discuz提供的`ajaxget`或`ajaxpost`方法。例如:

  1. function loadData() {
  2.     ajaxget('your_ajax_url.php', 'result_div', 'loading_div');
  3. }
复制代码

- `your_ajax_url.php` 是你要调用的AJAX处理文件的URL。
- `result_div` 是用于显示AJAX返回结果的HTML元素的ID。
- `loading_div` 是用于显示加载状态的HTML元素的ID。

### 4. 示例代码
以下是一个简单的示例,展示如何在不调用头部和尾部模板的情况下使用Discuz的AJAX功能:

  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4.     <title>全屏地图</title>
  5.     <!--{subtemplate common/header_common}-->
  6. </head>
  7. <body>
  8.     <div id="map" style="width: 100%; height: 100vh;"></div>
  9.     <div id="result_div"></div>
  10.     <div id="loading_div" style="display: none;">加载中...</div>

  11.     <script type="text/javascript">
  12.         function loadData() {
  13.             ajaxget('your_ajax_url.php', 'result_div', 'loading_div');
  14.         }

  15.         // 释放jQuery对$字符的控制权
  16.         jQuery.noConflict();

  17.         // 页面加载完成后执行AJAX调用
  18.         window.onload = function() {
  19.             loadData();
  20.         };
  21.     </script>

  22.     <!--{subtemplate common/footer}-->
  23. </body>
  24. </html>
复制代码


### 5. 注意事项
- 确保`your_ajax_url.php`文件正确处理AJAX请求并返回正确的数据格式。
- 如果你在页面中使用了其他JavaScript库(如Prototype),确保它们与jQuery兼容,或者使用`jQuery.noConflict()`来避免冲突。

通过以上方法,你可以在不调用头部和尾部模板的情况下,仍然使用Discuz的AJAX功能。
-- 本回答由 人工智能 AI智能体 生成,内容仅供参考,请仔细甄别。
我要说一句 收起回复

回复

 懒得打字嘛,点击右侧快捷回复【查看最新发布】   【应用商城享更多资源】
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

关闭

站长推荐上一条 /1 下一条

AI智能体
投诉/建议联系

discuzaddons@vip.qq.com

未经授权禁止转载,复制和建立镜像,
如有违反,按照公告处理!!!
  • 联系QQ客服
  • 添加微信客服

联系DZ插件网微信客服|最近更新|Archiver|手机版|小黑屋|DZ插件网! ( 鄂ICP备20010621号-1 )|网站地图 知道创宇云防御

您的IP:18.226.166.141,GMT+8, 2025-3-29 06:29 , Processed in 0.355022 second(s), 82 queries , Gzip On, Redis On.

Powered by Discuz! X5.0 Licensed

© 2001-2025 Discuz! Team.

关灯 在本版发帖
扫一扫添加微信客服
QQ客服返回顶部
快速回复 返回顶部 返回列表