Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

I want to add PHP support for emmet (sublime). How to make PHP profile? for emmet #307

Closed
picwellwisher12pk opened this Issue · 30 comments

2 participants

Amir Hameed Sergey Chikuyonok
Amir Hameed

How can I add php profile. I am using Sublime Text 2. Then I can add a full length of snippts ready for it.

Sergey Chikuyonok
Owner
Amir Hameed

i want to add support for php

Sergey Chikuyonok
Owner
Amir Hameed

http://docs.emmet.io/customization/syntax-profiles/ =>
"But sometimes you’d like to force Emmet to use another profile for specified syntax or use your own profile with specific rules.

In this case, you should create syntaxProfiles.json file in extensions folder and specify profile for a required syntax. "

This is what it says on the site. But i m still not sure what is the complete and proper method.

Sergey Chikuyonok
Owner
Amir Hameed
Amir Hameed

:( It means my work is confined to Zen Coding only.

Sergey Chikuyonok
Owner
Amir Hameed

Actually I want those snippets to be available for people. Not for my own use only. I have already written many snippets for PHP and Wordpress for Zen Coding. And I am using it for sometime.

Amir Hameed

I have seen this link , but this will not work for php , right?

Amir Hameed

Any way thanks for your time bro.

Sergey Chikuyonok
Owner

Just pushed update with improved syntax detection, it should handle PHP too.

Note that in PHP abbreviations must be expanded with Ctrl-E shortcut, the Tab expander requires additional config and will likely break native ST snippets.

Amir Hameed
Amir Hameed
Sergey Chikuyonok
Owner

You need to create snippets-php.json file (or use any other name, just make sure it starts with snippets: http://docs.emmet.io/customization/snippets/#sharing-snippets) with the following content:

{
    "php": {
        "snippets": {
            // your snippets here
        }
    }
}

Then put in into extensions folder and restart editor.

Amir Hameed

:(. didn't work.

Sergey Chikuyonok
Owner

Can you tell me what you did?

Amir Hameed
  1. made a folder name "php" in "Sublime Text 2\Packages\Emmet\"
  2. created a file name "snippets-php.json" in that above php folder.
  3. Content of snippet file is :
    {
    "php": {
    "filters": "php",
    "snippets": {

        "php:Ns":       "<?php\nnamespace |;\n\t\n?>",
        "php:ns":       "namespace |;",
    
        "php:Class":    "<?php\nclass |\n{\n\t\n}\n?>",
        "php:class":    "class |\n{\n\t\n}",
                     ...
                     ...
    }
    

    }
    }

  4. In Editor : Emmet Menu> Settings - User > the added :

{
"extensions_path": "~/php"

}

Sergey Chikuyonok
Owner
  1. Your extensions_path value resolves to php folder in your home folder, e.g. /Users/%YOUR_NAME%/php. The ~ character refers to user’s HOME folder.

  2. You don’t need "filters": "php" since there’s no such filter.

Amir Hameed
  1. I removed "filters" line.
  2. Even added the full absolute url : "c:/users/[My username]/AppData/Roaming/Sublime Text 2/Packages/Emmet/php". .Still Not working.

Tell me I am not bothering. I don't want to actually.

Sergey Chikuyonok
Owner

When Emmet starts, it shows Loading Emmet extensions from XXX folder message in console. Make sure it’s the right folder.

Amir Hameed

this is what i m looking for . some log. that may tell me what is going on.

Amir Hameed

Last day it was not working. I even checked the extension path in the log of Sublime Text. Path was ok. But the plugin didn't work. Then I tried to restart it the application. But Sublime didn't started. It was there in tasklist but didn't appear on the screen.

Now Today, everything is just fine.

Emmet is working happily with PHP. I just need to change the snippets little bit according to Emmet and escape $ sign and some other characters i guess.

Thank you soooo much Sergeche.

Sergey Chikuyonok
Owner

Great!

Sergey Chikuyonok sergeche closed this
Sergey Chikuyonok
Owner

I think you should check your computer for viruses, it’s the second message with the same content.

Amir Hameed
Amir Hameed

that's embarrassing.

Amir Hameed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.