zoukankan      html  css  js  c++  java
  • thinkphp3.2自定义success及error跳转页面

    首先我们需要配置目录

    在conf下新建一个config文件

    <?php
    
    return array(
      'TMPL_ACTION_SUCCESS'=>'Public:dispatch_jump',
        'TMPL_ACTION_ERROR'=>'Public:dispatch_jump',
    );
    

     指定模板的位置,是view下面的Public文件夹下的dispatch_jump.tpl

    这个文件在ThinkPHP/Tpl/dispatch_jump.tpl,我们把它拷贝过来

    复制到view下面的Public文件夹下

    然后进行对应的修改就行了

    主要是想说用smarty模板的情况

    如果用的smarty模板,config文件应该这样写

    <?php
    
    return array(
    'TMPL_ACTION_ERROR' => 'Public:error',
    'TMPL_ACTION_SUCCESS' => 'Public:success',
    );
    

     public下的模板文件我们需要写两个,一个是success.html,一个是error.html

    内容和dispatch_jump.tpl其实是基本一样,就是要把标签换成smarty标签

    <?php echo($jumpUrl); ?>这个,我们把他替换成{$jumpUrl}就可以了

    下面贴一下

    error.html

    <?php
        if(C('LAYOUT_ON')) {
            {$smarty_const__NOLAYOUT__};
        }
    ?>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>跳转提示</title>
    <style type="text/css">
    *{ padding: 0; margin: 0; }
    body{ background: #fff; font-family: '微软雅黑'; color: #333; font-size: 16px; }
    .system-message{ padding: 24px 48px; }
    .system-message h1{ font-size: 100px; font-weight: normal; line-height: 120px; margin-bottom: 12px; }
    .system-message .jump{ padding-top: 10px}
    .system-message .jump a{ color: #333;}
    .system-message .success,.system-message .error{ line-height: 1.8em; font-size: 36px }
    .system-message .detail{ font-size: 12px; line-height: 20px; margin-top: 12px; display:none}
    </style>
    </head>
    <body>
    <div class="system-message">
    <present name="message">
    <h1>:(</h1>
    <p class="error">{$error}</p>
    </present>
    <p class="detail"></p>
    <p class="jump">
    页面自动 <a id="href" href="{$jumpUrl}">跳转</a> 等待时间: <b id="wait">{$waitSecond}</b>
    </p>
    </div>
    <script type="text/javascript">
    (function(){
    var wait = document.getElementById('wait'),href = document.getElementById('href').href;
    var interval = setInterval(function(){
    	var time = --wait.innerHTML;
    	if(time <= 0) {
    		location.href = href;
    		clearInterval(interval);
    	};
    }, 1000);
    })();
    </script>
    </body>
    </html>
    
  • 相关阅读:
    NiosII软处理器快速入门- 10分钟学会NiosII(2)
    FFT算法的一种FPGA实现
    32个最热CPLDFPGA论坛
    NiosII软处理器快速入门- 10分钟学会NiosII(3)
    基于FPGA/CPLD设计与实现UART
    NiosII软处理器快速入门- 10分钟学会NiosII(1)
    LCD 的分类和显示原理
    iis6.0重写成html设置
    p标签之间的行距问题
    ie6 png图片透明方法
  • 原文地址:https://www.cnblogs.com/anxiaoyu/p/6897550.html
Copyright © 2011-2022 走看看