420 Creative - Portland Web Design Studio

420 Creative to the Rescue!

Oct 19 2009

Angie Herrera

Studio News

There's plenty to be said about poorly written code. Not only can it be a serious nightmare to maintain, it can quickly cause problems down the road, regardless if it's PHP, CMS code, HTML, CSS, JavaScript, what have you. And the magnitude of horrors can greatly become amplified if the developer tried to use a CMS they're unfamiliar and inexperienced with. But that's exactly what happened to National Physicians Alliance.

The call for help

NPA runs on ExpressionEngine and much to her credit, NPA's webmaster tried to get things working again, including asking for help on the EE Support Forums. She took the good advice from the EE tech support team to get in touch with a professional EE developer, many of which are listed in their Pro Network. And so we received an email asking for help with the site.

In a nutshell, the site was displaying every page across the (large-ish) site incorrectly and PHP errors cropped up everywhere. Considering the current health reform debate and the organization's goals, they needed to get back up and running ASAP. So we accepted the task to get the site back to its normal self.

Bad code

My hope was to find a really quick fix in order to save the organization further downtime and money, but what we discovered wasn't pretty.

We were given access to the site and the first thing I did was take an hour and evaluate the code. In that hour I saw that the code inside EE's templates was fighting against its template engine. The custom PHP that was written by the original developer was essentially duplicating EE's built-in functionality. Worse, it wasn't even working right.

The fix

Rather than attempt to patch the code (which could cause further problems down the road), we got approval from NPA to fix it the right way. So I rolled up my sleeves and re-coded the core templates to remove the PHP code altogether (none of it was needed in the first place) and use EE's native functionality to get the site back to where it was prior to the whole issue.

Wrapping it all up

The actual recoding wasn't difficult, but it took some time. But even then we spent just 5 hours fixing the entire site. So within a day of the initial email, NPA was back up and running. More importantly, the code is now stronger and much easier to maintain should the need arise. Plus, since it uses EE's native functionality, it's more versatile in terms of building on what's there. The project meant I stayed up way past my bedtime, but it was great to help out and NPA was left with a better code base than before.

 

Update - 08/07/11

I'm not sure when (looks like maybe earlier this year), but NPA has since redesigned and rebuilt their site. It no longer runs on ExpressionEngine. When I see this happen it always makes me shake my head a little bit in sadness because they had a really great CMS but probably a really poor experience with it because the original developer didn't know what he (or she) was doing. I have seen this before with other software (Magento, Drupal, etc.) and it's a shame.