zoukankan      html  css  js  c++  java
  • 织梦后台表单数据提醒

    只是个简单查询:

    1 在dede/index.php 中写入一行代码:require(DEDEADMIN.'/../plus/form_alert.php');

    2 然后在 dede/templets/index2.htm 的 "<div class="sysmsg"><h3>滚动消息:</h3>" 部位改变代码:

    <h3><?php if(isset($formAddMsg)){echo $formAddMsg . '有消息';} ?></h3>
    <script type="text/javascript">
    $(function(){
    function getFormMsg() {
    $.ajax({
    type: 'get',
    url: '/plus/form_alert_ajax.php',
    data: 'getform=1',
    dataType: 'json',
    success: function(re) {
    var res = re;
    console.log(res);
    if(res != 'false'){
    $('.sysmsg>h3').text(res+'有消息');
    } else {
    $('.sysmsg>h3').text('无消息');
    }
    }
    });
    }
    var timer = setInterval(getFormMsg,120000);
    });
    </script>

    3 增加文件 ./plus/form_alert_ajax.php 代码:

     1 <?php
     2     require_once ("/../include/common.inc.php");
     3 
     4     if($dsql->IsTable('qx_diyform1')){
     5          //如果存在qx_diyform1表
     6          //-------------------
     7         $sql = "SELECT count(ifcheck) FROM qx_diyform1 WHERE ifcheck = 0";
     8         $dsql->Execute('me',$sql);
     9         if($dsql->GetArray('me')['count(ifcheck)']>0){
    10             $formAddMsg = ' qx_diyform1 ';
    11         }
    12       }
    13       if($dsql->IsTable('qx_diyform2')){
    14          //如果存在qx_diyform2表
    15          //-------------------
    16         $sql = "SELECT count(ifcheck) FROM qx_diyform2 WHERE ifcheck = 0";
    17         $dsql->Execute('me',$sql);
    18         if($dsql->GetArray('me')['count(ifcheck)']>0){
    19             $formAddMsg .= ' qx_diyform2 ';
    20         }
    21       }
    22       if($dsql->IsTable('qx_diyform3')){
    23          //如果存在qx_diyform3表
    24          //-------------------
    25         $sql = "SELECT count(ifcheck) FROM qx_diyform3 WHERE ifcheck = 0";
    26         $dsql->Execute('me',$sql);
    27         if($dsql->GetArray('me')['count(ifcheck)']>0){
    28             $formAddMsg .= ' qx_diyform3 ';
    29         }
    30       }
    31       $res = isset($formAddMsg) ? $formAddMsg : 'false';
    32       echo json_encode($res);

    结果如下:

  • 相关阅读:
    Class加载顺序
    Java中9大内置基本数据类型Class实例和数组的Class实例(转载)
    java配置日志总结
    Java格式化CST时间(mysql date类型)
    对称二叉树
    模拟--滑动窗口最大值
    group by两个条件
    P1996 约瑟夫问题
    C++命名空间、标准库(std,全局命名空间)
    java中引用对比C++指针
  • 原文地址:https://www.cnblogs.com/init-007/p/10790847.html
Copyright © 2011-2022 走看看