Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Phpstorm zen coding: insert <?php ?> tag

Tags:

phpstorm

emmet

Is there a built-in zen coding shortcut in PhpStorm to insert a <?php ?> tag? If not, how would I go about setting one?

like image 716
David John Smith Avatar asked May 29 '11 00:05

David John Smith


5 Answers

No there is not, You can set it by Going to File -> Settings -> -- IDE Settings -- -> Live Templates -> Add And using the following values:-

Abbreviation: php
Group: user
Template Text: <?php $END$ ?>
Context: Check HTML

like image 181
Salman von Abbas Avatar answered Sep 30 '22 00:09

Salman von Abbas


In PhpStorm2016.1 must change Applicable in Value to HTML .

Go to File -> Setting -> Editor -> Code Style -> Live Templates On right sidebar click on "+" then : Abbreviation : (for example) p Template text : Applicatin :change the value to HTMLl like befor then click on ok .

enter image description here

like image 21
abadooz Avatar answered Sep 29 '22 23:09

abadooz


In newer versions of PhpStorm(2019.* or higher) adding the shortcut is a little bit different.

First go to File -> Settings (or simply press CTRL + ALT + S). Open Editor tab and find Live Templates tab. Select PHP and click small blue plus icon at the right sidebar, select live template and:

  1. Type shortcut on Abbreviation input.
  2. Type <?php $END$ ?> on template text area.
  3. Define applicable context like php and html.
  4. If you want to expand with another key instead tab, you must define another expand key.

Click Apply and OK buttons. That's it.

like image 40
Teoman Tıngır Avatar answered Sep 30 '22 00:09

Teoman Tıngır


Go to

File --> Settings --> Search & click Live Templates

Click + button on the right side then click Live Template

lastly input following:

Abbreviation: PHP
Template Text: <?php $END$ ?>
Context: Check HTML

Click Apply then OK

Now type php and press tab in a php file

 PHP tag (<?PHP ?>) will automatically generated
like image 21
Masrur Sakib Avatar answered Sep 30 '22 00:09

Masrur Sakib


You can set it by going to File -> Settings -> -- IDE Settings -- -> Live Templates

and then input

Abbreviation: php
Group: user
Template Text: php $END$ ?>
Context:
Check HTML
like image 30
user3037113 Avatar answered Sep 30 '22 00:09

user3037113