yii2support icon indicating copy to clipboard operation
yii2support copied to clipboard

Your plugin can't find views' files

Open mike-kramer opened this issue 6 years ago • 29 comments

In all my working controllers and widgets your plugin show it can't find a view file

Additional info

Q A
IDE Name PhpStorm
IDE Version 2017.3.4
Plugin version 0.8.42.5
Yii App Template basic

mike-kramer avatar Mar 28 '18 08:03 mike-kramer

Yii project root is PhpStorm project root?

nvlad avatar Mar 28 '18 08:03 nvlad

Yes. And I tried to point Yii root in plugin settings - no result. And I've just updated PhpStorm to 2017.3.6 - the situation is same. Once plugin found my views, but after a couple of hour it doesn't again.
image

mike-kramer avatar Mar 28 '18 11:03 mike-kramer

I've tried this: image Now plugin finds my views

mike-kramer avatar Mar 28 '18 12:03 mike-kramer

Same problem.
image

PhpStorm 2017.3.6 Plugin 0.8.42.5 Yii project root is PhpStorm project root.

rusniker avatar Mar 29 '18 09:03 rusniker

I still have the same problem. This problem appeared about 2 months ago. Before that it worked perfectly.

PhpStorm 2017.3.5 and also in PhpStorm 2018.1

Renkas avatar Mar 29 '18 15:03 Renkas

I have this problem only with my old projects. Today I started new Yii2-project, and plugin works with it perfect.

mike-kramer avatar Mar 29 '18 18:03 mike-kramer

I'm also have this problem. With a new project this is work perfect. I try use PhpStorm 2017.3.x and PhpStorm 2018.1

View file for "create" not found in "/modules/modules/[name]/views/[name]/create.php". less... (Ctrl+1) Reports missing view templates

I don't know why it creates double path 'modules'

asamats avatar Apr 03 '18 07:04 asamats

my path to /modules/[module_name]/frontend/views do not recognizing too.

andrew-svirin avatar Apr 03 '18 14:04 andrew-svirin

i found it to.

papppeter avatar Apr 24 '18 15:04 papppeter

In our team projects i use such structure: /modules/[module]/views/[web_end]/[controller]/view.php if you add support, i'd be grateful.

yujin1st avatar May 24 '18 01:05 yujin1st

see my picture.

if there is a missing view, it creates it. the path is correct. but after creation it does not find it any more.

our modules structure is: /modules/[module]/[web_end]/views/[controller]/view.php

thanks for your help

screenshot_4

papppeter avatar Jun 13 '18 07:06 papppeter

Баг появился с версией 0.8.38 Откатился на 0.7.35.2 - все стало в порядке. Посмотри, что менял между этими версиями. Возможно быстро поймешь причину. Все, что выше 0.8.38 сломано (перепробовал все от 0.9.54.9)

a6ka avatar Jun 20 '18 13:06 a6ka

@a6ka в версии 0.8.* была полностью переделана работа с вьюхами. Как закончу с миграциями, вернусь к вьюхам.

nvlad avatar Jun 22 '18 09:06 nvlad

Same here with version 0.10.56.15 and PhpStorm 2018.2.1 (Linux). However, the concering project contains just a Yii module, but with normal controllers, models, views. Can it also be related to the namespace? If I let the view file be created the namespace of the current controller gets used, but my namespace has some additional elements prepended, so the view file does not get created at the correct position. Therefore my guess is the Yii root path setting is not enough - there should be also a namespace setting so that view files gets created into the right directory.

I have another project that was originally an yii2-advanced project and here SOME view files can be found (a pity when 'it works sometimes' ... ;-) ) There is one controller with the correct view file linking option: If I choose 'Go to declaration' I have to choose between the correct one and vendor/codeception/base/tests/data/app/controllers.php. Other controllers show a red line under the view file name, but 'Go to declaration' works anyway and leads again to the test file.

Btw one question: what happens if the Yii root path setting is blank? Will then the regular project root path be used? It seems to me that I don't have to populate this setting. Could you add this to the Readme file, please?

robsch avatar Aug 22 '18 14:08 robsch

In some projects it works fine and in some it does not work at all. I compared settings for the "Yii2 Support', but found no differences.

What can we do to fix this? Any workarounds?

CrazyHenk44 avatar Oct 10 '18 13:10 CrazyHenk44

Использую версию 0.10.56.18. Не видит view подключаемых через $this->render() в контролерах, выдаёт ошибку View file for views not found in /modules/modules/production/views/frontend/products/view.php предлагает создать представление. Если создать, то файл создаётся по пути app\modules\modules\production\views\frontend\products Используется темизация или нет - не играет роли. Специально создал проект, настроил темизацию, все представления в контролерах определяет.

slo-nik avatar Oct 15 '18 21:10 slo-nik

Modules are located at/root/common/modules, but module controllers are giving view not found error. Controller namespace is modules\[module]\controllers and plugin is looking at '/root/common/[module]/views instead of /root/common/modules/[module]/views. Plugin version v0.10.56.22

stevekr avatar Nov 28 '18 09:11 stevekr

I just found this thread and am experiencing the same problem--view files are not recognized within controllers.

View file for "contact" not found in "//views/site/contact.php". Inspection info: Reports missing view templates

PhpStorm 2018.3 Build 183.4284.150 Yii2 Support version 0.10.56.22

Mitchell64 avatar Dec 03 '18 18:12 Mitchell64

Same issues with 2019.1 EAP!

blacksmoke26 avatar Mar 13 '19 00:03 blacksmoke26

Same issue, 2019.1. Is there any solution?

dekmabot avatar Apr 02 '19 11:04 dekmabot

Still not fixed, searches for /modules/modules/{module}/views dir.

Lisio avatar Apr 22 '19 17:04 Lisio

Still no solution, can it be reverted back to simple ../views resolve, this is more common to yii development. Or add it to a config to use this not the advanced one, which cannot really handle complex projects? @nvlad i know you are busy but maybe it would be a quick fix, and than many of us could use view part correctly.

our project structure is: /modules/[module]/[app]/controllers/[controller]Controller.php /modules/[module]/[app]/views/[controller]/view.php /common /backend /fronted

but app directories dose not have any controllers, views inside, only web root, and config.

now it creates the view file in controller action, but after successfully creation it does not find any more. if i am in a view render() does not complete.

i am using the latest plugin version. (i tried to use more version over time, but none of them fixed this issue)

thanks for your time!

papppeter avatar Jun 29 '19 08:06 papppeter

Just discovered that removing the defined view path and root path fixes it for the advanced template. Well at least for now, hopefully it keeps working. It is probably not ideal, but at least it finds now views related correctly to backend/frontend folder.

in .idea/yii2settings.xml I just deleted those lines:

    <option name="yiiRootPath" value="C:\laragon\www\..." />
    <option name="viewPathMap">
      <map>
        <entry key="@backend/themes/*/modules" value="@backend/modules" />
        <entry key="@backend/themes/*/widgets" value="@backend/widgets" />
        <entry key="@backend/themes/*" value="@backend/views" />
        <entry key="@frontend/themes/*/modules" value="@frontend/modules" />
        <entry key="@frontend/themes/*/widgets" value="@frontend/widgets" />
        <entry key="@frontend/themes/*" value="@frontend/views" />
      </map>
    </option>

edit: 🤯10mins later and it stops working !?

My6UoT9 avatar Aug 23 '19 11:08 My6UoT9

The only working variant found for now is to set alias like this:

Image 9

And then use alias in render function: return $this->render('@frontend/views/abc/xyz');

aadutskevich avatar Sep 27 '19 11:09 aadutskevich

Still not working. Fix it plz.

makbeth avatar Mar 07 '20 16:03 makbeth

Still not working. PHPStorm 2019 modules/modules/[my_name_module]/* not working only basic

lllyx1 avatar May 31 '20 18:05 lllyx1

Everyone complaing about not working please check the solution from @mike-kramer from Mar 28, 2018. Adding one line in the theme path maps helps.

rastikw avatar Dec 23 '20 15:12 rastikw

I solved the problem. Clear Yii Root Path in settings. It helped for me 2021-03-05_14-00-20

There is no need to change the Views settings. If you have a default structure basic or advanced template

2021-03-05_14-05-55

sokollondon avatar Mar 05 '21 09:03 sokollondon