Solved

PHP tidy code

Posted on 2007-11-15
15
1,072 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
3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

 
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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

Suggested Solutions

Generating table dynamically is the most common issue faced by php developers.... So it seems there is a need of an article that explains the basic concept of generating tables dynamically. It just requires a basic knowledge of html and little maths…
Introduction This article is intended for those who are new to PHP error handling (https://www.experts-exchange.com/articles/11769/And-by-the-way-I-am-New-to-PHP.html).  It addresses one of the most common problems that plague beginning PHP develop…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
The viewer will learn how to dynamically set the form action using jQuery.

810 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