Sublime Forum

PHP filetype using HTML snippets

#1

I’m not sure exactly when (I’ve been working on other languagues for awhile) but I’m guessing around the time that I updated to 1.4, all PHP snippets fail to work in PHP files (yes, the filetype is loaded as PHP in the bottom-right corner).

Instead, any HTML snippet seems to work fine. Also, if working in another language file (i.e. java) the respective snippets work fine.

Anyone else have this problem or can shed light on a fix?

0 Likes

#2

The php snippets should be working - they are for me in a quick test at least. They should trigger within <?php ... ?> blocks: press ctrl+alt+p and check the status bar, it should look something like “source.php.embedded.block.html text.html.basic”. If any of the fragments there contain “source.php”, as in the previous example, then the snippets should be triggering ok.

0 Likes

#3

I noticed two things that may have caused problems:
When I first started sublimetext, even though I had a PHP file open it was initially set to HTML mode- changing it to PHP kept resetting it to HTML. I had fixed this by closing and reopening the program, and clearing out some user settings- I had quotes around a setting that probably didn’t need them.

Also, I had a doc block that wasn’t registering as being inside of a <?php ?> tag set, it was missing a space after <?php
After a bit of frustration, it seems to be working well enough.

Another side note that this wasn’t really normal behavior: Hitting tab would move the cursor to a random location on the page- after hitting tab 3 or 4 times, though, it would return to its original location and start inserting 4 spaces as usual.

Everything seems to be back to normal though

0 Likes