ThinkPHP3.2.2 custom success and error jump page

Source: Internet
Author: User
Tags smarty template

The default thinkphp success and error default template is not very good-looking, below to share how to customize the success and error page, here is thinkphp 3.2. Version 2
Default thinkphp success and error default template is not very good-looking, below to share how you customize success and error page, here is thinkphp 3.2.2 version
First add the following code in the configuration file (/application/admin/conf/config.php)
Customizing success and Error prompt page templates
' tmpl_action_success ' = ' public:dispatch_jump ',
' Tmpl_action_error ' = ' public:dispatch_jump ',
Here the error and success is a common template file, the code is as follows (/application/admin/view/public/dispatch_jump.html)

<!DOCTYPE HTML Public "-//W3C//DTD XHTML 1.0 transitional//en" "http://www.w3.org/TR/xhtml1/DTD/ Xhtml1-transitional.dtd ">    <HTMLxmlns= "http://www.w3.org/1999/xhtml">    <Head>    <Metahttp-equiv= "Content-type"content= "text/html; charset=utf-8" />    <title>Jump Tips</title>    <styletype= "Text/css">    *{padding:0;margin:0; }Body{background:#fff;font-family:' Microsoft Ya Black ';Color:#333;font-size:6px; }. Message{width:400px;Height:150px;margin:Auto;Border:1px solid #1B8F24;Margin-top:30px;}. Head{width:100%;Height:30px;background:RGB (222,245,194);text-align:Center;Padding-top:5px;}. Content{Height:120px;width:100%;}. Success,. Error{text-align:Center;Margin-top:30px;}. Jump{text-align:Center;Margin-top:20px;}    </style>    </Head>    <Body>    <Divclass= "message">    <Divclass= "Head"><span>Ace Admin Tip information:</span></Div>    <Divclass= "Content">    <?php if (isset ($message)) {?>    <Pclass= "Success">:)<?php Echo ($message);?></P>    <?PHP}else{?>    <Pclass= "Error">:(<?php Echo ($error);?></P>    <?php}?>    <Pclass= "Detail"></P>    <Pclass= "Jump">    <aID= "href"href= "<?php echo ($JUMPURL);?>">If your browser does not automatically jump, please click here ...</a>    <BR/>Wait Time:<bID= "Wait"><?php Echo ($waitSecond);?></b>    </P>    </Div>    </Div>    <Scripttype= "Text/javascript">    (function(){    varwait=document.getElementById ('wait'), href=document.getElementById ('href'). href; varinterval=SetInterval (function(){    var Time= --wait.innerhtml; if( time<= 0) {Location.href=href;    Clearinterval (interval);    }; },  +);    })(); </Script>    </Body>    </HTML>

Ways to use the Smarty template to parse a program

Change the configuration first.
' Tmpl_action_error ' = ' public:error ',
' tmpl_action_success ' = ' public:success ',
Then create a public folder under the view file to build two html:success.html and error.html
Copy the contents of the THINKPHP/TPL/DISPATCH_JUMP.TPL.
Delete and replace all PHP tags inside, because smarty is not <?php?> this thing.
Just change it to a smarty label.
For example, you find <?php echo ($JUMPURL);?> This, we replace him with {$JUMPURL}, and so on.

ThinkPHP3.2.2 custom success and error jump page

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.