How can I tell what the consultant did?

I got a PHP/MySQL system that was coded a few years ago by consultants from Thailand that did not document anything. I am a C# ASP.NET guy.

To get myself up-to-speed I purchased murach’s PHP and MySQL book and started reading. I understand the book. The book shows PHP at the top of the HTML in each form. The book suggest you use NetBeans as and IDE and Notepad++ as a simple editor. So far, I am liking PHP and MySQL.

I go into the consultants code and it looks nothing like the examples in the book. It appears to be PHP all over the place with a little HTML embedded in these long undocumented routines. After a few days of research, it appears the consultants are dynamically building each page through various php files.

I cannot tell what IDE the consultants used except for Notepad++. I see Zend Optimizer on the web server. This entire system seems like a bunch of spaghetti code.

How does a noob get through this project? Any tips would be appreciated.

How large is it? Are you able to zip it up and share so that we can do a quick code review? It sounds like I would be tempted to suggest scrapping the code alltogether, but it would be nice to see it first ^^

I can sympathize with your situation. Looking at a complex php application for the first time can be rather confusing. It’s also an excellent learning tool.

My advice would be to start at the top of the index.php. Follow its flow. When you see an include open it up and see what all it does. If you’re going edit, maintain, and add additional features to this site you are really going to have to get a feel for the flow of it and its file structure.

There is going to be tons of functions and code snippets that you are not going to understand or that seem confusing but lucky php is very well documented and easy to find answers to questions with internet searches.

When making edits to existing pieces of code I recommend always making a backup of the original file and testing small changes to the code at a time. When I’m developing I tend to do many small edits and saves followed by page refreshes when fine tuning an application. Nothing is more frustrating than putting in a lot of work on a large piece of code only to test it and have fail to load and offering no explanation.

You may also want to add comments with in the code.
Reminders for yourself as to what pieces of code do.

Your server error logs will also help you identify problem and errors in code.

If it’s within your budget I really do recommend purchasing Adobe Dreamweaver if not the entire Adobe Creative Suite. Having the ability to search the entire site and all of its files for functions and snippets of code and the ability to do live code view is an amazing help when making changes to existing applications.

I’ve never used NetBeans, it may or may not offer the same features.

True, but it’s a terrible learning tool if the code is crap.

Even when working alone on small projects I strongly suggest to use version control, svn or git is extremely simple to set up, or you can even get some free repositories at https://bitbucket.org/

Things like that are exactly what IDE’s are for :slight_smile: Never really used dreamweaver as it has had a reputation of beeing messy (todays frontpage of sorts)

How large is it? Are you able to zip it up and share so that we can do a quick code review?

Jim, the smallest I can get the website zip is 5 mb. I tried sending it via personal mail but the largest attachment is 250K.

Another 2 tools I find invaluable, since I work on windows is.

Beyond Compare and Powergrep.

http://www.powergrep.com/
http://www.scootersoftware.com/

I also syn via Project Locker for source Control works great, integrates great with Visual Studio IDE (I’m a .net coder as well)

http://projectlocker.com/

Sponsor our Newsletter | Privacy Policy | Terms of Service