请把轻狂志网址 www.flighty.cn 加入收藏夹,其他俱为假冒,谨防被骗!赞助请点 这里!找东东请用右边的搜索 ===>
24 2010-02

DEDEv5.5提示信息框美化

作者:ccwo | 发布:2010-02-24 | 更新:2010-02-24 | 分类:教程 | Tutorial | 热度:

图示:

 

说明:添加了几个图片,对输出的HTML做了修改,其他的逻辑语句、执行语句没有修改,对函数添加了一个参数$sname="『轻狂志』提示消息:"

文件:include/common.func.php

用以下代码替换372-434行(如果你修改过这个文件,行数可以有所不同,请以实际为准。如果你懒得修改文件,可以下载附件。)

function ShowMsg($msg,$gourl,$onlymsg=0,$limittime=0,$sname="『轻狂志』提示消息:")
{
    if(empty($GLOBALS['cfg_phpurl'])) $GLOBALS['cfg_phpurl'] = '..';

    $htmlhead  = "<html>\r\n<head>\r\n<title>".$sname." </title>\r\n<meta http-equiv=\"Content-Type\" content=\"text/html; charset=gb2312\" />\r\n";
    $htmlhead .= "<base target='_self'/>\r\n<style>div{line-height:160%;}body{background:url({$GLOBALS['cfg_phpurl']}/img/smg_bg.gif);}</style></head>\r\n<body leftmargin='0' topmargin='0'>".(isset($GLOBALS['ucsynlogin']) ? $GLOBALS['ucsynlogin'] : '')."\r\n<center>\r\n<script>\r\n";
    $htmlfoot  = "</script>\r\n</center>\r\n</body>\r\n</html>\r\n";

    $litime = ($limittime==0 ? 1000 : $limittime);
    $func = '';

    if($gourl=='-1')
    {
        if($limittime==0) $litime = 5000;
        $gourl = "javascript:history.go(-1);";
    }

    if($gourl=='' || $onlymsg==1)
    {
        $msg = "<script>alert(\"".str_replace("\"","“",$msg)."\");</script>";
    }
    else
    {
        //当网址为:close::objname 时, 关闭父框架的id=objname元素
        if(eregi('close::',$gourl))
        {
            $tgobj = trim(eregi_replace('close::', '', $gourl));
            $gourl = 'javascript:;';
            $func .= "window.parent.document.getElementById('{$tgobj}').style.display='none';\r\n";
        }
       
        $func .= "      var pgo=0;
      function JumpUrl(){
        if(pgo==0){ location='$gourl'; pgo=1; }
      }\r\n";
        $rmsg = $func;
        $rmsg .= "document.write(\"<div style='width:450px;margin-top: 50px;'>";
        $rmsg .= "<div style='font-size:12px;height: 49px;width: 450px; background:url({$GLOBALS['cfg_phpurl']}/img/wbg_meihua.gif);'><span style='display:block;line-height: 49px; clear: none;float: left;height: 49px;width: 50px;'><a style='display:block;height: 49px;width: 50px;' href='javascript:history.go(-1);' title='返回'></a></span><span style='display: block;clear: none;float: left;height: 20px;width: 400px;font-family: 微软雅黑;font-size: 12px;line-height: 20px;padding-top: 20px;padding-bottom: 9px;text-align: left;'>".$sname."</span></div>\");\r\n";
        $rmsg .= "document.write(\"<div style='display: block; clear: none; float: left; width: 450px; padding-bottom: 9px; background-color: #98e6f9; padding-right: 9px; padding-left: 9px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; border-right-style: solid; border-bottom-style: solid; border-left-style: solid; border-right-color: #50a5ba; border-bottom-color: #50a5ba; border-left-color: #50a5ba;'>\");\r\n";
        $rmsg .= "document.write(\"<div style='display: block; clear: none; float: left; width: 430px; background-color: #FFFFFF; font-size: 12px; line-height: 20px; color: #000000; padding: 15px; font-family: Arial, 宋体;'>\");\r\n";
        $rmsg .= "document.write(\"".str_replace("\"","“",$msg)."\");\r\n";
        $rmsg .= "document.write(\"";
        $rmsg .= "</div>";
        if($onlymsg==0)
        {
            if( $gourl != 'javascript:;' && $gourl != '')
            {
                $rmsg .= "<div style='border-top: 1px solid #EEEEEE;display: block; clear: none; float: left; width: 430px; background-color: #F3F3F3; font-size: 12px; line-height: 40px; font-family: Arial, 宋体; text-align: right; height: 40px;'><a href='{$gourl}'><span style='color: #666666;text-decoration: none;'>如果你的浏览器没反应,请点击这里...  </span></a>    </div>";
                $rmsg .= "</div>\");\r\n";
                $rmsg .= "setTimeout('JumpUrl()',$litime);";
            }
            else
            {
                $rmsg .= "</div></div>\");\r\n";
            }
        }
        else
        {
            $rmsg .= "</div></div>\");\r\n";
        }
        $msg  = $htmlhead.$rmsg.$htmlfoot;
    }
    echo $msg;
}

图片:

添加一背景图片smg_bg.gif ,
添加一个图片wbg_meihua.gif,
图片大家自己做,两个图片均在/plus/img/文件夹下。

标签:美化(7)dede(33)信息框(1)