gasdg
(2)
1
How can I get a link to the file "css / js"?
The thing is that I’ve tried everything, changes in main.php, etc.
I have used these codes but it did not work.
echo $this->theme->baseUrl;
OR
echo $this->theme->getBaseUrl(); //It always appears empty
Always obtain a link like this:
/var/www/html/yii/web/themes/mytheme/web/js/
or similar incorrect.
Link that I would get this: /var/www/html/yii/themes/mytheme/web/js or /themes/mytheme/web/js
Can you help my ?
gasdg
(2)
2
Can someone will help me?
Bizley
(Bizley)
3
Does Yii::app()->theme->getBaseUrl(); work?
gasdg
(2)
4
I get error:
PHP Fatal Error – yii\base\ErrorException
Call to undefined method Yii::app()
If i use this:
echo Yii::$app()->theme->getBaseUrl();
I get this error:
PHP Notice – yii\base\ErrorException
Undefined variable: app
Or if i use this code:
echo $this->theme->getBaseUrl();
not receiving any results, the effect of NULL
gerrit
(gerrit_)
5
try:
Yii::$app->theme->getBaseUrl();
rqwdsf
(3)
6
Unfortunately, nothing still does not work, even such a solution.
<img src="<?php echo Yii::$app->assetManager->publish('@app/themes/mytheme/web/')[0] ?>/images/myimg.jpg" alt="logo">
(I also used:Yii::$app->assetManager->publish(’@app/themes/mytheme/web/’))
rqwdsf
(3)
7
I have one problem, my views file is located here:
/var/www/html/yii/themes/mytheme/web/views/site/index.php
a photograph that needs to be used here:
/var/www/html/yii/themes/mytheme/web/images
I care about the views that files can display images, but do not know how to do it.