Solved

PHP tidy code

Posted on 2007-11-15
15
1,075 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

 
LVL 21

Accepted Solution

by:
nizsmo earned 500 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

Enroll in May's Course of the Month

May’s Course of the Month is now available! Experts Exchange’s Premium Members and Team Accounts have access to a complimentary course each month as part of their membership—an extra way to increase training and boost professional development.

Question has a verified solution.

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

Deprecated and Headed for the Dustbin By now, you have probably heard that some PHP features, while convenient, can also cause PHP security problems.  This article discusses one of those, called register_globals.  It is a thing you do not want.  …
Foreword (July, 2015) Since I first wrote this article, years ago, a great many more people have begun using the internet.  They are coming online from every part of the globe, learning, reading, shopping and spending money at an ever-increasing ra…
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
The viewer will learn how to dynamically set the form action using jQuery.

738 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