Yii 2 double-collar style
-
I didn't see the second version of the layout on the controller, and I kind of can't follow the common template.
I want to make a double-cracker.
#leftcol { /* Левая колонка */ float: left; /* Обтекание справа */ width: 20%; /* Ширина колонки */ } #rightcol { /* Правая колонка */ margin-left: 21%; /* Отступ слева */ } .container { width: 100%; }
How is this problem addressed?
-
Enough to create
layout
that you want to use and connect it whenever you want.e.g. in the counteraller:
namespace app\controllers;
use yii\web\Controller;
class YourController extends Controller {
public $layout = 'column2';
// ...
}
In the case:
public function actionYourAction($id) {
$this->layout = 'yourNewLayout';return $this->render('yourView', [ 'model' =>$model, ]);
}
♪
view
(if I'm not mistaken):$this->context->layout = 'your-layout';
♪ ♪ ♪
or by placing all the app globally in the configuration:
...
$config = [
'layout' => 'yourLayout',
...