致力于为用户提供真实的
主机测评数据及优惠信息

织梦DEDECMS提示信息提示框美化

你是否已经看腻了织梦官方默认的提示信息窗口?来,让你的眼睛闪亮一下,质感美化版的提示信息窗口来了!

提示效果

织梦DEDECMS提示信息提示框美化爱主机评测网,最优惠主机信息推荐,便宜VPS分享,香港CN2

实现教程

打开 /include/common.func.php 找到 大概在278行的

  1. function ShowMsg( 
  2. { 
  3.     中间代码省略… 
  4. } 

 

把整个函数改成

  1. function ShowMsg($msg, $gourl, $onlymsg=0, $limittime=0) 
  2. { 
  3.     if(emptyempty($GLOBALS['cfg_plus_dir'])) $GLOBALS['cfg_plus_dir'] = '..'; 
  4.  
  5.     $htmlhead  = "<html>rn<head>rn<title>提示信息</title>rn<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />rn<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">rn<meta name="renderer" content="webkit">rn<meta http-equiv="Cache-Control" content="no-siteapp" />"; 
  6.     $htmlhead .= "<base target='_self'/>rn<style>div{line-height:160%;}</style></head>rn<body leftmargin='0' topmargin='0' bgcolor='#FFFFFF'>".(isset($GLOBALS['ucsynlogin']) ? $GLOBALS['ucsynlogin'] : '')."rn<center>rn<script>rn"; 
  7.     $htmlfoot  = "</script>rn</center>rn</body>rn</html>rn"; 
  8.  
  9.     $litime = ($limittime==0 ? 1000 : $limittime); 
  10.     $func = ''; 
  11.  
  12.     if($gourl=='-1') 
  13.     { 
  14.         if($limittime==0) $litime = 5000; 
  15.         $gourl = "javascript:history.go(-1);"; 
  16.     } 
  17.  
  18.     if($gourl=='' || $onlymsg==1) 
  19.     { 
  20.         $msg = "<script>alert("".str_replace(""","“",$msg)."");</script>"; 
  21.     } 
  22.     else 
  23.     { 
  24.         //当网址为:close::objname 时, 关闭父框架的id=objname元素 
  25.         if(preg_match('/close::/',$gourl)) 
  26.         { 
  27.             $tgobj = trim(preg_replace('/close::/', '', $gourl)); 
  28.             $gourl = 'javascript:;'; 
  29.             $func .= "window.parent.document.getElementById('{$tgobj}').style.display='none';rn"; 
  30.         } 
  31.  
  32.         $func .= "      var pgo=0; 
  33.       function JumpUrl(){ 
  34.         if(pgo==0){ location='$gourl'; pgo=1; } 
  35.       }rn"; 
  36.         $rmsg = $func; 
  37.         $rmsg .= "document.write("<style>body{background:#F6F6F6}.tips-box{margin-top:50px;padding:0;width:450px;border:10px solid #E8E8E8;background:#fff;color:#444;font-family:微软雅黑}.tips .title{margin:0 20px;padding:15px 0;border-bottom:1px dotted #DDD;text-align:left;font-size:15px}.tips .title p{padding-left:10px;height:18px;border-left:2px solid #268B26;font-weight:600;line-height:18px;margin: 0;}.tips .content{position:relative;padding:30px;height:120px;background:#fff;color:#666;font-size:15px}.tips .content p.tip{color:#999;font-size:1px}.tips .content a.go{display:block;margin:15px auto 0;padding:6px 10px;width:80px;border:1px solid #268B26;border-radius:3px;color:#268B26;text-decoration:blink;font-size:13px}.tips .content a:hover{background:#268B26;color:#fff}</style>");rn;"; 
  38.         $rmsg .= "document.write("<div class='tips tips-box'>"; 
  39.         $rmsg .= "<div class='title'><p>提示信息</p></div>");rn"; 
  40.         $rmsg .= "document.write("<div class='content'>");rn"; 
  41.         $rmsg .= "document.write("".str_replace(""","“",$msg)."");rn"; 
  42.         $rmsg .= "document.write(""; 
  43.  
  44.         if($onlymsg==0) 
  45.         { 
  46.             if( $gourl != 'javascript:;' && $gourl != '') 
  47.             { 
  48.                 $rmsg .= "<a href='{$gourl}' class='go'>点击跳转</a>"; 
  49.                 $rmsg .= "<br/></div>");rn"; 
  50.                 $rmsg .= "setTimeout('JumpUrl()',$litime);"; 
  51.             } 
  52.             else 
  53.             { 
  54.                 $rmsg .= "<br/></div>");rn"; 
  55.             } 
  56.         } 
  57.         else 
  58.         { 
  59.             $rmsg .= "<br/><br/></div>");rn"; 
  60.         } 
  61.         $msg  = $htmlhead.$rmsg.$htmlfoot; 
  62.     } 
  63.     echo $msg; 
  64. } 

完成!

注意:如果你有改过这个函数,记得备份一个你的再尝试!

赞(0) 打赏
未经允许不得转载:爱主机 » 织梦DEDECMS提示信息提示框美化
分享到: 更多 (0)

评论 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址