Posts from December 2010
Xdebug, var_dump, and nested arrays
Xdebug is a must-have for local development, giving you step-through debugging and nicely formatted error messages, among other things. One of the mixed blessings it brings is that it overrides var_dump()
. The display is a little nicer than the default, but it also cuts off at the third level of nested arrays or objects. This cuts the legs out from under Drupal developers: everything in Drupal uses nested arrays, and if you're trying to debug a problem or figure out where some data is stored, chances are good that you'll need to go five or six levels deep into an array to find your answer. Thankfully, the Xdebug developers were kind enough to include a configuration settings for this: xdebug.var_display_max_depth. You can increase the depth limit by adding a line to your php.ini
file. I bumped the limit to 10 on my machine: xdebug.var_display_max_depth = 10
Related Items
When it comes to showing things like related news, or section highlights, I've gotten so accustomed to using node reference fields or a View to list nodes tagged with the same terms. I forget that sometimes, the content administrators will be perfectly happy to build their own list in the node body with a WYSIWYG editor. On a current project, they want more fine-grained control over the list, and it saves me time as the site builder. Everybody wins!