D
D
darknet372017-03-22 11:07:28
Yii
darknet37, 2017-03-22 11:07:28

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

1 answer(s)
M
Maxim Fedorov, 2017-03-22
@darknet37

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 question

Ask a Question

731 491 924 answers to any question