webyjh 2012-01-08 16:27:25 2548次浏览 1条回复 1 0 0

通过GII生成的视图文件 update.php create.php _form.php,简单情况下可以通过一个判断合并成一个_form文件 把

$this->render('create',array('model'=>$model,));
$this->render('update',array('model'=>$model,));

改成 $this->render('_form',array('model'=>$model,));

然后在_form文件里判断一下

<?php if($model->isNewRecord==1):?>
<h2 style='text-align: center;color:red;'>您正在新增记录</h2>
<?php else:?>
<h2 style='text-align: center;color:red;'>您正在修改记录</h2>
<?php endif;?>
.....
您需要登录后才可以回复。登录 | 立即注册