如果我們的controller裡有兩個action, 我要如何各別設定layout?
class IntroductionController extends Controller {
public $layout = '//layouts/common'; //設一個這個controller預設的layout
public function actionShowMe() {
$this->render('showme'); //使用上面預設的layout!
}
public function actionSeeYou(){
$this->layout = '//layouts/custom_layout'; //這樣就可以使用別的layout了!
$this->render('seeyou');
}
}
參考資料:
沒有留言:
張貼留言