Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

PHP tidy code

Posted on 2007-11-15
15
Medium Priority
?
1,092 Views
Last Modified: 2012-08-13
I am wondering if anyone knows of a PHP code tidier, I have seen: http://prettyprinter.de/ But try to tidy some PHP and it changes <b> to the &3t, like that and messes with my HTML.

Any suggestions on a PHP cody tidier?
0
Comment
  • 8
  • 7
15 Comments
 
LVL 21

Expert Comment

by:nizsmo
ID: 20291460
You can try  SourceFormatX:
http://www.textrush.com/formatx.htm

Hope this helps.
0
 
LVL 21

Expert Comment

by:nizsmo
ID: 20291465
Also for your HTML you can try this see how good it works:
http://www.phpbuilder.com/manual/en/ref.tidy.php
0
 
LVL 1

Author Comment

by:catonthecouchproductions
ID: 20291493
I am also on a Mac any suggestions there?
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
LVL 21

Accepted Solution

by:
nizsmo earned 2000 total points
ID: 20291663
sorry not that i know of. Although time consuming, it may be best to tidy the code manually using a good editor, as i find that you know exactly what has been done to the code, instead of taking a chance where the code may be change in some way by the code tidier program.

Hope this helps in some way.
0
 
LVL 1

Author Comment

by:catonthecouchproductions
ID: 20291683
Thats a good point, get you use to your own code, etc.
0
 
LVL 21

Expert Comment

by:nizsmo
ID: 20291700
yep, and you know that you woudn't run into any trouble.
A good practice though is to try and keep your code tidy when writing it, so that you don't have to do this at the end!

Indentation and commenting your code is an essential practice to good programming for any language.
0
 
LVL 1

Author Comment

by:catonthecouchproductions
ID: 20292063
I know :) I need to keep that in mind, haha.
0
 
LVL 21

Expert Comment

by:nizsmo
ID: 20292087
All good :)

sorry i couldn't suggest a straight solution to your problem, but hopefully what i said has helped in some way.
0
 
LVL 1

Author Comment

by:catonthecouchproductions
ID: 20295017
Thats fine! Thanks anyway. Have you tried that link you sent me? Just curious to see how well code tidiers work, trial run.

Ryan
0
 
LVL 21

Expert Comment

by:nizsmo
ID: 20295062
Which one are you talking about? SourceFormatX?
I had that installed for a while, it does do a reasonable job at tidying it up, however I don't like the feeling of letting another program take control of my code, so eventually i abandoned it. :)
0
 
LVL 1

Author Comment

by:catonthecouchproductions
ID: 20295084
Haha...yeah, I was talking about the PHP add on the php site. Are you talking about SourceFormatX?
0
 
LVL 21

Expert Comment

by:nizsmo
ID: 20295126
Yes sorry was talking about the wrong thing:p

as for the other one, i used it a while back, it was OK.

There is this new one (HTML TIdy) for PHP5, looks very cool and easy to use if you are thinking about tidying up your code using php:
http://devzone.zend.com/node/view/id/761

0
 
LVL 1

Author Comment

by:catonthecouchproductions
ID: 20295164
Oh nice, let me take a look at this, does that just do PHP? Or HTML/PHP as well.

I couldnt really tell from the site.
0
 
LVL 21

Expert Comment

by:nizsmo
ID: 20295177
i think it does html side of things only (css, html, etc...not sure about javascript), as it is CALLED from PHP, so it can't tidy itseif :P
0
 
LVL 1

Author Comment

by:catonthecouchproductions
ID: 20295260
Hahahaha valid point!

RYan
0

Featured Post

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Author Note: Since this E-E article was originally written, years ago, formal testing has come into common use in the world of PHP.  PHPUnit (http://en.wikipedia.org/wiki/PHPUnit) and similar technologies have enjoyed wide adoption, making it possib…
Many old projects have bad code, but the budget doesn't exist to rewrite the codebase. You can update this code to be safer by introducing contemporary input validation, sanitation, and safer database queries.
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
Suggested Courses

963 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question