14

I'm looking so long for a Dreamweaver extension to auto beautify PHP / JavaScript / jQuery code. Currently Dreamweaver can beautify only HTML and CSS (Apply Source Formatting).

Any kind of help will be much appreciated.

Songo
  • 5,618
  • 8
  • 58
  • 96
Adnan
  • 2,001
  • 2
  • 26
  • 28
  • weird. My copy of DW (CS5) formats PHP code while typing, but not JS, jQ, HTML and CSS. How do you do it for HTML and CSS? – Pranav Hosangadi Nov 15 '11 at 05:20
  • DW is pretty expensive peace of software that don't have some basic features - like code formatting for JavaScript or PHP >:( – enloz Nov 18 '11 at 15:01
  • There is an extension to format javascript source - http://www.adobe.com/cfusion/exchange/index.cfm?event=extensionDetail&extid=2107536 – Praveen Vijayan Apr 02 '12 at 03:41
  • @PraveenVijayan — there is no javascript formatting extension for DW. – Kirk Ross Mar 10 '16 at 19:22

10 Answers10

3

Online solutions for validation and formatting JavaScript:

Validate JavaScript code:
http://www.javascriptlint.com/

Format JavaScript code:
http://jsbeautifier.org/
2

You can use PhpEdit, it's an extra debugger!
DW doesn't do debug, you find the error if and only if you run your code.

With PhpEdit, it is onTime.

Toon Krijthe
  • 52,876
  • 38
  • 145
  • 202
samia
  • 21
  • 5
  • Unfortunately this tool doesn't exists anymore and their website is very much broken, which makes this answer obsolete. – AaA Sep 09 '19 at 14:42
2

For the PHP side of things use https://github.com/fabpot/PHP-CS-Fixer

This short excerpt and more information is taken from the README.

Installation:

Download the php-cs-fixer.phar file and store it somewhere on your computer.

Usage:

The fix command tries to fix as much coding standards problems as possible on a given file or directory:

php php-cs-fixer.phar fix /path/to/dir

php php-cs-fixer.phar fix /path/to/file
Sathyajith Bhat
  • 21,321
  • 22
  • 95
  • 134
antony
  • 2,763
  • 19
  • 23
2

I have found this great dreamweaver extenstion, just give it a try

Their Homepage: http://www.decodize.com/projects/

extension download page: http://www.adobe.com/cfusion/exchange/index.cfm?event=extensionDetail&loc=en_us&extid=2107536

shandoosheri
  • 492
  • 1
  • 6
  • 16
1

Maybe try http://www.javascriptlint.com/ says it works on some IDEs, maybe DW is one of them.

Try googling, but use 'code format' not 'beautify'

Jake N
  • 10,535
  • 11
  • 66
  • 112
1

I was wondering if you could elaborate on how to set this up. I see the CSS and Tag Libraries options under "Advanced Formatting", but I am stuck at that point as to how to get my PHP to start auto-indenting.

Or, if Dreamweaver has somehow fixed this problem, let me know! It seems like every other IDE has an auto-indent feature! Thanks :)

Bryan Miller
  • 3,262
  • 4
  • 27
  • 51
0

Best way i found is to set the way Dreamweaver displays code yourself. Sure it takes some time to do but its worth it.

Here is how:

Dreamweaver: Edit > Preferences > Code Format

Then under Advanced Formatting you can pick CSS... or Tag Libraries...

You can make any of your code look as it should this way.

Like i said, will take some time but do it once and you can keep using it with all your future Dreamweaver versions.

Drmzindec
  • 804
  • 2
  • 15
  • 28
0

It's been a while since I have used DW, I use Aptana now and there is an option to format the code from one of the drop down menus. Just use something like "control a" (To select all your code), "control f" (To format your code). There might be another key combination but I think this will work if memory serves.

Maybe "esc control f"

Phill Pafford
  • 83,471
  • 91
  • 263
  • 383
0

I've not seen anything for Dreamweaver, but if you can copy ans paste the code, http://jsbeautifier.org/ can help you with making code look a good bit better. I've just tried it on some packed JavaScript and it worked out very well. You can also download the application and run it locally (it's only HTML and JavaScript), so you won't need an internet connection to get your code prettier.

Danilo Celic
  • 2,467
  • 1
  • 16
  • 8
-4

In Dreamweaver CS6 no need any other extension or tools. Just select your code and then Go to 'Commands' > 'Apply Source Formatting' or 'Apply Source Formatting to Selection'

Done. :)

MiPhyo
  • 49
  • 5