S
S
Skrolea2016-06-19 01:00:17
Yii
Skrolea, 2016-06-19 01:00:17

How to set the path to img?

What am I confused about.
I have a modal window in my template main.php, which opens by clicking in the topbar and an image opens in it at the address

"../img/map/metro.png" alt="" class="img-responsive">

and everything is ok if I do it on the main page ( SiteController actionIndex).
But as soon as I switch to another method ( SiteController - actionSecond) - the modal window opens in the same way, but the Second method is added to the image address and, accordingly, is not shown. those. coming outsite.ru/second/img/map/metro.png - 404

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Alexey, 2016-06-19
@alsopub

Replace "../img/map/metro.png" with an absolute path, in your case, probably "/img/map/metro.png" and forget about problems with opening images.

A
Anton Natarov, 2016-06-19
@HanDroid

Try to display image like this
look at Predefined Aliases and indicate at the beginning, so you will immediately know where to get them from.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question