P
P
pvkopa2018-07-27 16:33:05
Yii
pvkopa, 2018-07-27 16:33:05

How to make a clickable logo on all pages except the main one?

Hello. I want to make sure that the link on the main page does not work, but works on all other pages.
here is the code

<!-- Логотип в шапке -->
              <div class="header__logo">
                <div class="header-logo">
                  <div class="header-logo__box">
                    <a class="header-logo__href" href="<?php echo Yii::app()->baseUrl;?>/">
                    <img class="header-logo__img" src="<?php echo Yii::app()->theme->baseUrl;?>/images/logo.png" width="300" height="75" alt="дженерики для повышения потенции купить" />
                    </a>

Answer the question

In order to leave comments, you need to log in

3 answer(s)
C
coderisimo, 2018-07-27
@coderisimo

Something like that :

<a class="header-logo__href" href="<?= Yii::$app->request->scriptUrl === '/site/index.php' ? '#' : Yii::app()->baseUrl ?>/">

E
Eugene, 2018-07-27
@iamd503

Write a condition, if we are on the main page, then add a link, and if not, then do not add. Yii probably has it

O
Otrivin, 2018-07-28
@Otrivin

Compare $_SERVER["REQUEST_URI"] with "/" and "/index.php"

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question