Answer the question
In order to leave comments, you need to log in
Data from the session is not displayed. Yii2?
I opened the session in the controller, did everything that was needed and passed it all to VIEW.
When VIEW opens, all data is displayed and displayed.
Tell me how can I display this data from the session in layout (main.php).
I'm trying to display the same as in VIEW - it doesn't work.
In VIEW I write like this:
<?php if(!empty($session['cart'])): ?>
<?= $session['cart.qty']?>
<?= $session['cart.sum']?>
<?php else: ?>
<h3>Корзина пуста</h3>
<?php endif;?>
Answer the question
In order to leave comments, you need to log in
The documentation describes in detail how to work with a session . Study these materials and you will no longer have any questions
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question