Yii-跳转页面-用法(仅限zyd项目)
2013-01-16 10:43
316 查看
控制器
方法1
默认3秒后跳转到定义的第一个链接
另一种js跳转方式,它会替代全部页面显示,没有布局文件,可用于ajax更新的时候错误跳转
视图页面
效果图
方法1
//执行操作 if(Product::model()->updateAll($set,$criteria)){ //成功跳转 $this->render('../index/success',array('message'=>'恭喜,产品审核成功')); exit; }else{ //失败跳转 $this->render('../index/error',array('message'=>'对不起,产品审核操作失败,请稍后再试!')); exit; }
默认3秒后跳转到定义的第一个链接
$this->render('../index/success',array( 'message'=>'恭喜,宝贝信息发布成功', 'links'=>array( array('浏览发布的产品','/company/product/update/id/'.$model->zp_id), array('继续发布产品','/company/product/create/step/1'), ), )); exit;
另一种js跳转方式,它会替代全部页面显示,没有布局文件,可用于ajax更新的时候错误跳转
if(!MemGroup::model()->exists($criteria)){ jsRedirect($url,'2','操作错误,选中项操作名不能为空','controllerActions'); exit; }
视图页面
<!--操作成功 start--> <div class="change_done bd_db"> <p> <span class="ico_big ico_done"></span> <span class="fw_b fs_14"><?php echo isset($message)?$message:'操作成功' ?></span> </p> <p class="line_30">现在去, <?php foreach($links as $link){ echo CHtml::link($link[0],$link[1],array('class'=>'c_06c mr10')); } ?> </p> <p class="c_666 ml40">该页将在 <span id='setouttime'>3</span>秒后自动跳转!</p> </div> <!--操作成功 end--> <script language=javascript> var int=self.setInterval("countdown()",1000); function countdown(){ var t=document.getElementById("setouttime").innerHTML-1; document.getElementById("setouttime").innerHTML=t; if(t===0){ location='<?php echo $links[0][1]?>'; } } </script>
效果图
相关文章推荐
- Yii-跳转页面-用法(仅限zyd项目)
- 项目集成zxing扫描二维码并跳转页面
- struts2重点、精华、用法总结(二):接受请求参数及页面跳转类型
- 【前台】【单页跳转】整个项目实现单页面跳转,抛弃iframe
- Android初级开发第九讲--Intent最全用法(打开文件跳转页面等)
- 同一项目下页面跳转bundle下的storyboard里
- yii中登录后跳转回登录前请求的页面
- Android项目页面跳转小Demo
- javaWeb项目用过滤器filter实现登陆成功后才能访问主页面,否则直接输入主页面的地址自动跳转到登陆界面
- 项目访问是直接页面 <jsp:forward page="i/1/1"/>跳转前加操作逻辑
- 在react-native的项目中跳转到原生iOS页面
- 跳转到指定页面popToViewController用法
- Android初级开发第九讲--Intent最全用法(打开文件跳转页面等)
- [安卓] 7、页面跳转和Intent简单用法
- iOS项目开发实战——使用三种方式实现页面跳转与参数传递(一)
- springmvc页面跳转时的路径问题需要使用/项目名/。。。。。。必须的
- javaweb项目的jsp页面跳转问题
- Ionic3项目开发——页面跳转与参数传递
- 一、东软实践项目2-基于android平台的应用开发:实现页面之间的跳转
- 自定义项目中的404页面,并且实现指定时间内跳转到一个指定的页面