• 织梦DedeCMS提示信息框的修改,修改ShowMsg方法函数


    http://www.360doc.com/content/14/0408/13/16498929_367236469.shtml

    织梦DedeCMS系统,处处都在用到提示信息,但是这个提示框,前台后台一层不变,太死板了,可能有很多人都有过去修改它的想法,只是苦于不知道去哪里改。今天我就来说说这个吧,DedeCMS的所有提示信息都是用ShowMsg方法进行处理的,这个函数存放在/include/common.func.php  源代码如下:

    织梦DedeCMS提示信息框的修改,修改ShowMsg方法函数


    01
    10function ShowMsg($msg, $gourl, $onlymsg=0, $limittime=0)
    11{
    12     if(empty($GLOBALS['cfg_plus_dir'])) $GLOBALS['cfg_plus_dir'] = '..';
    13 
    14     $htmlhead = "\r\n\r\n\r\n\r\n";
    15     $htmlhead .= "\r\n\r\n".(isset($GLOBALS['ucsynlogin']) ? $GLOBALS['ucsynlogin'] : '')."\r\n
    \r\n
    ;
    17 
    18     $litime = ($limittime==0 ? 1000 : $limittime);
    19     $func = '';
    20 
    21     if($gourl=='-1')
    22     {
    23         if($limittime==0) $litime = 5000;
    24         $gourl = ";";
    25     }
    26 
    27     if($gourl=='' || $onlymsg==1)
    28     {
    29         $msg = ";
    30     }
    31     else
    32     {
    33         //当网址为:close::objname 时, 关闭父框架的id=objname元素
    34         if(preg_match('/close::/',$gourl))
    35         {
    36             $tgobj = trim(preg_replace('/close::/', '', $gourl));
    37             $gourl = 'javascript:;';
    38             $func .= "window.parent.document.getElementByIdx_x('{$tgobj}').style.display='none';\r\n";
    39         }
    40          
    41         $func .= "      var pgo=0;
    42       function JumpUrl(){
    43         if(pgo==0){ location='$gourl'; pgo=1; }
    44       }\r\n";
    45         $rmsg = $func;
    46         $rmsg .= "document.write(\"
    " ;
    47         $rmsg .= "
    DedeCMS 提示信息!
    \");\r\n";
    48         $rmsg .= "document.write(\"

    \");\r\n"
    ;
    49         $rmsg .= "document.write(\"".str_replace("\"","“",$msg)."\");\r\n";
    50         $rmsg .= "document.write(\"";
    51          
    52         if($onlymsg==0)
    53         {
    54             if( $gourl != 'javascript:;' && $gourl != '')
    55             {
    56                 $rmsg .= "
    如果你的浏览器没反应,请点击这里..."
    ;
    \");\r\n" ;
    57                 $rmsg .= "
    58                 $rmsg .= "setTimeout('JumpUrl()',$litime);";
    59             }
    60             else
    61             {
    \");\r\n" ;
    62                 $rmsg .= "
    63             }
    64         }
    65         else
    66         {
    \");\r\n" ;
    67             $rmsg .= "

    68         }
    69         $msg = $htmlhead.$rmsg.$htmlfoot;
    70     }
    71     echo $msg;
    72}

    可以看出ShowMsg有四个参数,第一个参数是提示的信息,第二个就参数是跳转的地址,如果设置为-1的话,就是返回上一个页面,第三个参数其它就是定义是用弹出提示框,还是显示提示信息,第四个参数就是信息提示页面显示多久再进行跳转,默认是1秒种。修改这个提示框比较简单了,直接替换对应的文字

    这个提示框的CSS也是写在内部的,如果我们需要修改,可以在这里直接修改源码,甚至我们还可以为这个ShowMsg函数增加一个参数,然后根据这个参数,显示不同的效果。
  • 相关阅读:
    JDBC
    Listener监听器
    Filter过滤器
    Jstl标签库
    el表达式
    Ajax技术
    数据交换格式之
    MVC模式
    函数
    二维数组练习
  • 原文地址:https://www.cnblogs.com/lxwphp/p/15455167.html
Copyright © 2020-2023  润新知