Answer the question
In order to leave comments, you need to log in
Yii2 how to pass data from db to layout once?
Hello.
--
There is a solution that allows you to display content in a layout:
// в контроллере
public $test
public function actionIndex(){
$this->test = // присвоить значение, или результат работы метода
}
// в шаблоне
if(isset($this->context->test) && $this->context->test != null)
{
echo $this->context->test;
}
$x = Site::find()->where(['public' => $act])->all();
Answer the question
In order to leave comments, you need to log in
Create a widget that performs the functionality you need and display it in a layer
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question