使用布局,可大大减少重复的冗余代码;
1.制作布局文件;在/layouts/文件名,$content代表存储的视图渲染结果;
2.设置布局文件;在父类控制器/protected/components/Controller.php中修改
//public $layout='//layouts/column1';
3.调用布局文件;在控制器里边使用render()方法调用;
使用布局,可大大减少重复的冗余代码;
1.制作布局文件;在/layouts/文件名,$content代表存储的视图渲染结果;
2.设置布局文件;在父类控制器/protected/components/Controller.php中修改
//public $layout='//layouts/column1';
3.调用布局文件;在控制器里边使用render()方法调用;