简体   繁体   English

如何在PhpStorm上调试Latte模板?

[英]How to debug Latte templates on PhpStorm?

Is it possible to debug Latte templates in PhpStorm in the same manner as one would debug plain PHP? 是否有可能以与调试普通PHP相同的方式在PhpStorm中调试Latte模板?

The documentation says: 文件说:

If you are using an IDE with code stepping you can go through the generated PHP code of the template. 如果您使用带代码步进的IDE,则可以查看生成的模板PHP代码。

How to do this on PhpStorm? 如何在PhpStorm上执行此操作?

UPDATE : 更新

This depends on the environment, my question is related to Wordpress. 这取决于环境,我的问题与Wordpress有关。

I already found out that, in Wordpress, the generated PHP files can be found in the cache ( wp-content/uploads/cache/<theme>/_wplatte in my case). 我已经发现,在Wordpress中,生成的PHP文件可以在缓存中找到(在我的例子中是wp-content/uploads/cache/<theme>/_wplatte )。

It seems that the files are not re-generated each time a page is loaded, so one can set breakpoints there. 似乎每次加载页面时都不会重新生成文件,因此可以在那里设置断点。

BUT: I am still willing to accept a better, more complete answer, if anyone has better guidelines to offer... 但是:如果有人有更好的指导方针,我仍然愿意接受更好,更完整的答案......

What I usually do when debugging templates or other generated code is setting a breakpoint at a place where the template is generated and then stepping inside until I get inside the generated file. 调试模板或其他生成的代码时我通常做的是在生成模板的地方设置断点,然后进入内部,直到我进入生成的文件。 Or you can use a breakpoint in a known method (inside a helper for example) and then step out until you're in the template. 或者,您可以在已知方法中使用断点(例如,在帮助器内),然后逐步执行,直到您进入模板。

I'm afraid that there is no chance to set up latte debugging at least up to the point where standardized sourcemaps are a thing :) 我担心没有机会设置latte调试至少到标准化源图是一个东西:)

您可以在编译代码{debugbreak}中使用宏来设置断点

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM