1

Does Microsoft Expressions Web 4 has a option (or keyboard shortcut) to format PHP Code?

Nalaka526
  • 11,278
  • 21
  • 82
  • 116
  • 1
    Shouldn't you be doing this yourself? Of course you could be talking about formatting other people's code. In the former case, learning a good formatting pattern is a very good way to decrease the likelihood of bugs, as well as making your code more maintainable in the future. – Bojangles Jan 26 '12 at 10:37
  • What do you mean "format PHP". You mean indenting and syntax coloring? – alecwhardy Feb 01 '12 at 02:21
  • @alecwhardy I meant "Indenting". Actually Expression Web Has a option "Reformat HTML" which works only with HTML. – Nalaka526 Feb 01 '12 at 03:32
  • usually you have to do this yourself. PHP is a freely typed language so whitespace (indents) makes no difference; therefore the programs do not force this whitespace. – alecwhardy Feb 01 '12 at 03:35
  • unless the software is automatically coloring php code, detecting errors, etc. then it is most likely not going to indent for you – alecwhardy Feb 01 '12 at 03:36
  • 1
    I would recommend using NetBeans, PDT, Notepad ++, or another editor for PHP and using Expression Web only for the HTML and CSS. It is generally better to keep the HTML and the PHP sepereted. – alecwhardy Feb 01 '12 at 03:40
  • @alecwhardy It is automatically coloring the PHP code but does not have a option to "Format" the code. Anyway Thanks for the advice... – Nalaka526 Feb 01 '12 at 03:48

5 Answers5

1

Have you tried Ctrl+K+F this is the usual formatting for Visual Studio Codes for ASP.NET and C# codes. I assume Microsoft would make the feature's keyboard shortcut the same. If it does not work then probably there is no built in.

Nap
  • 8,096
  • 13
  • 74
  • 117
1

You can select all the code you want to indent and hit the tab key. It will indent all selected lines. If you want to reduce the indent press shift+tab.

It won't magically fix poorly formatted code, but it will help you quickly indent large blocks.

Paul Dessert
  • 6,363
  • 8
  • 47
  • 74
1

I don't know how it's related to MS Expressions but you can do the same from this tool: http://www.waterproof.fr/products/phpCodeBeautifier/

Otar
  • 2,561
  • 1
  • 20
  • 24
0

try this to format the code of an existing page:

Open the web page you want to reformat. In the Code pane, right-click and select Reformat HTML.

fahd4007
  • 544
  • 4
  • 14
0

Try using PHPStorm IDE to edit/format php code. The IDE has everything you may need to edit/format/deploy/refactor code.
With PHPStorm you can reformat the code by using CTRL+ALT+L.

tftd
  • 16,203
  • 11
  • 62
  • 106