user1263746
user1263746

Reputation: 6308

Eclipse Indentation PHP

I have a PHP project with mix of HTML and JavaScript. PHP scripts are inserted inline. Can I use Eclipse to indent the project? I just want the code to be properly indented and nor formatted. By formatting, I mean that Eclipse should not replace spaces with $nbsp and other changes.

Suggestions about tools apart from eclipse are also welcomed.

Upvotes: 2

Views: 1543

Answers (3)

Brent Self
Brent Self

Reputation: 362

I found this question searching for ways to improve (free and OpenSource) Zend Eclipse's code indentation. NetBeans for PHP has far superior code indentation, but I've always had trouble getting code completion to work well on framework based projects: Zend Framework, CakePHP, etc. The code completion in Zend Eclipse works really well. Aptana is decent, too.

NetBeans is great at syntax highlighting and formatting pages that are a heavy mix of PHP, JavaScript and HTML. Dreamweaver is really bad about losing the highlighting when mixing languages. The highlighting is decent in Eclipse, but fixing the indenting in PHP alone is just consuming too much time.

Upvotes: 1

metalfight - user868766
metalfight - user868766

Reputation: 2750

You can try Komodo Edit

http://www.activestate.com/komodo-edit/downloads

Very lightweight & have code indented feature & its Free !!

Hope Helps.

~K

Upvotes: 1

Baba
Baba

Reputation: 95101

I think for PHP you should use Zend Studio and it also based on Eclipse which i think you are already familiar with.

By default it does not replace spaces with &nbsp and also you can also include your own custom formatting structure

After Installation Go to

Preferences -> PHP -> Code Style -> Formatter

Click on new Enter a Name you can create your own formatting structure

The same does for your JavaScript or other preferred supported Zend Studio Languages

:)

Upvotes: 2

Related Questions