做一个更好看的前台信息提示框

浏览:3196 发布日期:2015/10/15 分类:技术分享
为OneThink做一个更好看的前台信息提示框(success和error两类),毕竟网站是做给客户看的吗:)

先上两个图片看下效果:


一、bootstrap.min.css
这两个图片是使用bootstrap实现的提示框样式。
我用的是Bootstrap v3.3.5,请确保已下载相关文件并放在目录下:
\Public\static\bootstrap3\css\bootstrap.min.css
并在以下文件中引用bootstrap.min.css样式
\Application\Home\View\default\Public\head.html
引用bootstrap.min.css样式的代码:<link href="__STATIC__/bootstrap3/css/bootstrap.min.css" rel="stylesheet">二、msg_error.html和msg_success.html
这两张图片调用的模板文件分别是:msg_error.html和msg_success.html
两个模板文件存放在目录:
\Application\Home\View\default\Public\

msg_error.html<extend name="Base/common" />
<block name="body">
    <BR><BR>
    <div class="col-lg-4 col-lg-offset-4">
        <div class="panel panel-danger">
            <div class="panel-heading">
                <div class="panel-title text-center">
                <img src="__PUBLIC__/Home/icon/206.png"> 有错误发生!
                </div>
            </div>
            <div class="panel-body text-center">
                <h3><?php echo($error); ?></h3>
            </div>
            <div class="panel-footer">
                <div class="panel-title text-center">
                三秒后自动返回<meta http-equiv=refresh content=3;url="<?php echo($jumpUrl); ?>"><BR><BR>
或<a id="href" href="<?php echo($jumpUrl); ?>">点击此链接,当即跳转</a>
                </div>
            </div>
        </div>
    </div>
</block>
msg_success.html<extend name="Base/common" />
<block name="body">
    <BR><BR>
    <div class="col-lg-4 col-lg-offset-4">
        <div class="panel panel-info">
            <div class="panel-heading">
                <div class="panel-title text-center">
                <img src="__PUBLIC__/Home/icon/205.png"> 操作成功!
                </div>
            </div>
            <div class="panel-body text-center">
                <h3><?php echo($message); ?></h3>
            </div>
            <div class="panel-footer">
                <div class="panel-title text-center">
                三秒后自动返回<meta http-equiv=refresh content=3;url="<?php echo($jumpUrl); ?>"><BR><BR>
或<a id="href" href="<?php echo($jumpUrl); ?>">点击此链接,当即跳转</a>
                </div>
            </div>
        </div>
    </div>
</block>
三、修改Controller.class.php
修改文件:
\ThinkPHP\Library\Think\Controller.class.php
在函数function dispatchJump中://修改:
$this->display(C('TMPL_ACTION_SUCCESS'));
//为:
$this->display('Public/msg_success');
//修改:
$this->display(C('TMPL_ACTION_ERROR'));
//为:
$this->display('Public/msg_error');
四、测试
测试方法:
\Application\Home\Controller\IndexController.class.php
在function index()函数中加入以下两句代码即可测试:$this->error('您的用户名已被其他人使用!');
//$this->success('您的邮箱已通过验证!');
在浏览器直接调用:
http://localhost/
即可查看到新的信息提示模板样式了!

五、资源
见附件

(完)

附件 15101503做一个更好看的前台信息提示框.rar ( 38.99 KB 下载:75 次 )

最佳答案
评论( 相关
后面还有条评论,点击查看>>