Answer the question
In order to leave comments, you need to log in
How to add a class in Yii2 if the page is not the main one for example?
Good afternoon, please tell me how to add a class in Yii2 if the page is not the main one, for example?
Is there a class <div class="header"></div>
how to add a class to the header if we are not on the main page?
to become like this:<div class="header header2"></div>
Answer the question
In order to leave comments, you need to log in
<?php if (\Yii::$app->request->baseUrl == '/'): ?>
<div class="header"></div>
<?php else: ?>
<div class="header header2"></div>
<?php endif ?>
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question