php snippets not working in sublime text 2?
-
13-12-2019 - |
Question
I am trying to set up sublime text 2 with PHP, but I am having some trouble getting the snippets to work. I have loaded a PHP project and see that the syntax is correctly set to PHP. When I go to preferences -> browse -> packages _>php , I can see a number of PHP snippets that I am unable to activate including $_files $_get ,$post. As far as I can tell, the tab trigger for these are '$_'
<snippet>
<content><![CDATA[\$_COOKIE['${1:variable}']]]></content>
<tabTrigger>$_</tabTrigger>
<scope>source.php</scope>
<description>COOKIE['…']</description>
</snippet>
but this does not generate any snippets being displayed, when I try it in a php file.
Can anyone give me advice on what to do next?
Thank you,
Bill.
Solution
Works on my Sublime Text 2, but only within the <?php ?>
tags, not just in a file called .php.
Typing "$_ + TAB" within <?php ?>
tags gives a list of all the $_ Snippets COOKIE, FILES, ENV, etc...
My next steps would be:
- Do other Snippets work?
- Did you create a Snippet that could overrule the $_ ?
- Re-install ;-)
OTHER TIPS
You enabled the source for php, you can only be call this snippet in your php file only.
- create new file and save as
somename.php
- write
<?php
after - type
$_
and hit TAB or Ctrl + Space
It generates the snippet, lets happy coding.