Community Documentation

Debugging: display all Drupal variables at the bottom of a page

Last updated August 26, 2009. Created by Phillip Mc on September 15, 2008.
Edited by bekasu, jhodgdon. Log in to edit this page.

Introduction

This is a very simple snippet I use to display all the Drupal variables available to a page when I'm testing/debugging a site.

Step 1 of 1

Using a text editor like Pspad or notepad, open up your node.tpl.php file and paste in the following snippet at the bottom of the file.

<?php
 
print '<pre>';
 
var_dump(get_defined_vars());
print
'</pre>';
?>

About this page

Drupal version
Drupal 4.5.x or older, Drupal 4.6.x, Drupal 4.7.x, Drupal 5.x, Drupal 6.x, Drupal 7.x
Audience
Designers/themers, Programmers

Theming Guide

Drupal’s online documentation is © 2000-2013 by the individual contributors and can be used in accordance with the Creative Commons License, Attribution-ShareAlike 2.0. PHP code is distributed under the GNU General Public License. Comments on documentation pages are used to improve content and then deleted.