As if the title doesn’t give away the whole plot, I’m currently working on a project that uses PHP–gasp! No, I’ve not abandoned ColdFusion, and too be completely honest, I’m kind of a PHP noob.
Sure, I can do a fair amount of things in PHP…you know, querying databases, echoing content, that kind of stuff. Where I really get hurt, though, is when things start to get complex.
NOTE: If you don’t particularly feel like reading and just want to see some code, be sure to check out my GitHub repo for this.
For example, I recently needed to build out an ExtJS View, and I wanted to have some pretty heavily-nested data. My ideal outcome would print something to the page like so:
Main Group 1 Category 1 Name 1 Name 2 Fav Color 1 Fav Color 2 Main Group 2 Category 1 Name 1 Name 2 Main Group 3 Category 2 Name 1 Category 3 Name 1
And so on. In other words, each step in the “tree” can have multiple children, which can themselves have multiple children, ad infinitum.
Now in ExtJS, creating a View is dead simple. You simply have to pass the View a JSON structure wherein each level is More >
I do not like PHP. Period. Sorry. I find it clunky and it makes me irritable. Sure, it's free, but so what? There's a lot of free things that I don't like (like the flu, for example).
What's my beef? Tonight, I launched my first successful WordPress integration. For the testing phase, I had the installation in a sub-folder off the main site. Everything worked great.
But finally I moved it to the root. Guess what? PHP got angry at me. On nearly every page I received this error:
"Warning: Cannot modify header information – headers already sent by (output started at blah, blah blah)."
Apparently this is common error, caused by whitespace. Really? Stupid. I can't believe that PHP can't process a file with whitespace…just seems really, well, dumb.
But the kicker is this: nothing changed between moving the files from my testing folder to the root! For whatever reason, PHP didn't care about it when it was in the testing folder, but then changed its mind when I moved the files. Again, dumb.
Anyway, the fix was really simple. Turns out that there were two lines of whitespace in my wp-config.php file, whitespace which I didn't put there (thanks WordPress).
Urghh. More >