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);

    结果如下:

  • 相关阅读:
    字串符相关 split() 字串符分隔 substring() 提取字符串 substr()提取指定数目的字符 parseInt() 函数可解析一个字符串,并返回一个整数。
    表单select相关
    createElement() 创建元素 appendChild()添加元素
    css
    docker基本操作
    redis安装及基本操作
    MongoDB安装 基本操作
    printf输出参数的顺序
    静态库与动态库的制作
    linux下ls、split、readlink、iconv命令
  • 原文地址:https://www.cnblogs.com/init-007/p/10790847.html
Copyright © 2011-2022 走看看