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 [...]
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 [...]