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

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

  1. /**
  2.  *  短消息函数,可以在某个动作处理后友好的提示信息
  3.  *
  4.  * @param     string  $msg      消息提示信息
  5.  * @param     string  $gourl    跳转地址
  6.  * @param     int     $onlymsg  仅显示信息
  7.  * @param     int     $limittime  限制时间
  8.  * @return    void
  9.  */
  10. function ShowMsg($msg, $gourl, $onlymsg=0, $limittime=0)
  11.  
  12. {
  13.     if(empty($GLOBALS['cfg_plus_dir'])) $GLOBALS['cfg_plus_dir'] = '..';
  14.     $htmlhead  = "<html>\r\n<head>\r\n<title>DedeCMS提示信息</title>\r\n<meta http-equiv=\"Content-Type\" content=\"text/html; charset=gb2312\" />\r\n";
  15.     $htmlhead .= "<base target='_self'/>\r\n<style>div{line-height:160%;}</style></head>\r\n<body leftmargin='0' topmargin='0' bgcolor='#FFFFFF'>".(isset($GLOBALS['ucsynlogin']) ? $GLOBALS['ucsynlogin'] :'')."\r\n<center>\r\n<script>\r\n";
  16.     $htmlfoot  = "</script>\r\n</center>\r\n</body>\r\n</html>\r\n";
  17.     $litime = ($limittime==0 ? 1000 : $limittime);
  18.     $func = '';
  19.  
  20.     if($gourl=='-1')
  21.     {
  22.         if($limittime==0) $litime = 5000;
  23.         $gourl = "javascript:history.go(-1);";
  24.     }
  25.     if($gourl=='' || $onlymsg==1)
  26.     {
  27.         $msg = "<script>alert(\"".str_replace("\"","“",$msg)."\");</script>";
  28.     }
  29.     else
  30.     {
  31.         //当网址为:close::objname 时, 关闭父框架的id=objname元素
  32.         if(preg_match('/close::/',$gourl))
  33.         {
  34.             $tgobj = trim(preg_replace('/close::/', '', $gourl));
  35.             $gourl = 'javascript:;';
  36.             $func .="window.parent.document.getElementById('{$tgobj}').style.display='none';\r\n";
  37.         }
  38.         $func .= "      var pgo=0;
  39.       function JumpUrl(){
  40.         if(pgo==0){ location='$gourl'; pgo=1; }
  41.       }\r\n";
  42.         $rmsg = $func;
  43.         $rmsg .= "document.write(\"<br /><div style='width:450px;padding:0px;border:1px solid #DADADA;'>";
  44.         $rmsg .= "<div style='padding:6px;font-size:12px;border-bottom:1px solid #DADADA;background:#DBEEBD url({$GLOBALS['cfg_plus_dir']}/img/wbg.gif)';'><b>DedeCMS 提示信息!</b></div>\");\r\n";
  45.         $rmsg .= "document.write(\"<div style='height:130px;font-size:10pt;background:#ffffff'><br />\");\r\n";
  46.         $rmsg .= "document.write(\"".str_replace("\"","“",$msg)."\");\r\n";
  47.         $rmsg .= "document.write(\"";
  48.         
  49.         if($onlymsg==0)
  50.         {
  51.             if( $gourl != 'javascript:;' && $gourl != '')
  52.             {
  53.                 $rmsg .= "<br /><a href='{$gourl}'>如果你的浏览器没反应,请点击这里...</a>";
  54.                 $rmsg .= "<br/></div>\");\r\n";
  55.                 $rmsg .= "setTimeout('JumpUrl()',$litime);";
  56.             }
  57.             else
  58.             {
  59.                 $rmsg .= "<br/></div>\");\r\n";
  60.             }
  61.         }
  62.         else
  63.         {
  64.             $rmsg .= "<br/><br/></div>\");\r\n";
  65.         }
  66.         $msg  = $htmlhead.$rmsg.$htmlfoot;
  67.     }
  68.     echo $msg;
  69. }
 

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

这个提示框的CSS也是写在内部的,如果我们需要修改,可以在这里直接修改源码,甚至我们还可以为这个ShowMsg函数增加一个参数,然后根据这个参数,显示不同的效果。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值