Answer the question
In order to leave comments, you need to log in
Variables in YII2?
Hello! I have a site on YII 2, I myself understand a little PHP, but my specialization is a bit off, and then this framework, so one question arose:
On the site, the variable <?php echo $usname; is displayed in certain places; ?> like this. But it is displayed strictly on certain pages. And I need to put it in layouts/main so that it is always visible.
To understand what the essence is, this is a brokerage admin panel, a framework on the UII, a minimum of changes. A person logs in> gets into a personal account. When you follow the links (choice of a broker, my accounts, etc), the inscription "username / balance" appears. But, because in the main layout, it is displayed in the content (page) variable, and I need to move it outside this div, where content is displayed. I can't figure out how to insert it into main.php so that it works and is displayed after login, regardless of the page.
Answer the question
In order to leave comments, you need to log in
https://github.com/yiisoft/yii2/blob/master/docs/g...
In the controller:
In layout:
<?= yii\widgets\Breadcrumbs::widget([
'links' => isset($this->params['breadcrumbs']) ? $this->params['breadcrumbs'] : [],
]) ?>
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question