4

Is it possible to debug Latte templates in PhpStorm in the same manner as one would debug plain PHP?

The documentation says:

If you are using an IDE with code stepping you can go through the generated PHP code of the template.

How to do this on PhpStorm?

UPDATE:

This depends on the environment, my question is related to 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).

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...

pedrouan
  • 12,762
  • 3
  • 58
  • 74
masa
  • 2,762
  • 3
  • 21
  • 32
  • You do it correctly, nette is watching the source file and it regenerate it only if the latte file is changed. So you can simply debug the generated file. – John Mar 07 '16 at 21:15
  • Yes, I have been doing this for quite a while now. Works perfectly (for my purposes). – masa Mar 08 '16 at 12:08

2 Answers2

2

You can use macro for settings breakpoints in compiled code {debugbreak}

jasir
  • 1,461
  • 11
  • 28
1

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 :)

Tomáš Fejfar
  • 11,129
  • 8
  • 54
  • 82