Attach Files to Taxonomy Terms in Drupal
From what I can tell, there are plenty of ways to attach files to nodes in Drupal, and even a few ways to attach them to users, but none that I could find to attach them to taxonomy terms (images through the Taxonomy Image module, for sure, but not files in general). My guess is [...]
Selectable Items per Page Hack for Drupal 6 Views
I’m sure regular contributors to Drupal will cringe at what I’m about to show you, but I found it to be a handy trick. Let’s say you’re using the Views module in Drupal 6 and you want a way to dynamically control the number of items listed in a view. In my case, a client [...]
How to Hotwire WordPress in 7 Steps
First, let me go ahead and set the right expectation for this article. This is a brief guide to gaining legitimate access to a WordPress site for which you do not know the username or password. This is NOT a guide on hacking a WordPress site. It’s a fine line, but there are legitimate reasons [...]
WYSIWYR: What You See is What You Regret
Once upon a time much earlier in my career, a coworker observed me composing code in a basic text editor and described the approach as, “Spartan.” I argued that my argument was cleaner, leaner, and all together better. My coworker argued that WYSIWYG code was more convenient and efficient. In the time since, I’ve progressed [...]
Shiver Me Timbers! jQuery Off the Starboard Bow!
Before you get confused, no, jQuery doesn’t have anything to do with pirates (at least, not that I’m aware of). In honor of International Talk Like a Pirate Day, I’ll be interspersing this post with random, distracting, inappropriate pirate jargon. Don’t blame me; blame the guys who started the meme. I’ve never been a big [...]
Debugging Syntax Errors in PHP
PHP is unforgiving of syntax errors. Misplaced a semicolon? White screen of death. Mismatched your single and double quotes? White screen of death. Considering a career in Ruby on Rails? White screen of death. Okay, maybe not the last one, but you get the point. Unless you beg and plead with it to output errors, [...]
Output a Snapshot of All Defined Variables in PHP
The following line of code is one of the most useful diagnostic tricks in my PHP coding arsenal: <?php echo ‘<pre>’; print_r(get_defined_vars()); echo ‘</pre>’; ?> Simply input the above snippet of code into any PHP file and you’ll get a browser-friendly snapshot of all variables defined in the current scope. This is especially handy in [...]
7 Keys to Courteous Coding
All too often in my professional career, I’ve been tasked with working on legacy code. For those of you unfamiliar with the term, “legacy” in the computing sense refers to old software that has been passed down. Often, legacy programs work just well enough to keep, but not well enough that they don’t require maintenance. [...]