A
A
arab7892016-05-12 14:20:05
Yii
arab789, 2016-05-12 14:20:05

YII2. How to properly use static resources for Backend and Frontend?

I am using advanced template for YII2. The problem is how to simultaneously access resources (images, etc.) from the frontend and backend. Now I made additional urlManagerFrontEnd, I don’t like that I need to specify the site domain by hand, is it possible to avoid this somehow? Or do you need to make the module static and handle everything there so that there is no problem of access from the frontend and backend?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
K
Kirill Arutyunov, 2016-05-12
@arab789

You can put the static folder next to backend and frontend and add symlinks from frontend/web and backend/web to it.

A
Anton Natarov, 2016-05-12
@HanDroid

Or you can not invent and just take aliases from the Documentation
and write understandable things

<?php echo Html::img('@web/images/brands/brand1.jpg') ?> 
/* Frontend/web/ или если юзается Backend приложение 
*то backend/web/ Будет. этот алиас ссылается на веб текущего приложения.
* в адвансед их два front и back 
* если вам нужны общие рессы создайте в common папку и стучать тогда так
@common
*/

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question