Within my themes page.tpl.php file it has a reference to a lot of variables like $head and $local_styles. What file are this variables stored at so that I can looked at what each of these variables represent? John

2 Answers 2


The values are not stored at all. Instead they are generated dynamically at run time and feed into the template. The list of variables is just there so you will know which variables exactly are available in any particular template.

If you want to examine their content, you can add

drupal_set_message(print_r($variable, TRUE));

to the template, and simply load the page. If you install the Devel module, you can get much easier to read output like this:


I frequently use dpm in my everyday work when debugging or building new code.

  • How would I change the contents of an existing variable within a template or add a new variable within a template? Jan 9, 2012 at 15:04
  • In short, you don't do either. Adding or altering content normally happens further up in the chain, when you are at the template stage, the only thing you should be controlling, is form, not content. There is not generic advice for adding new content, it depends to much on what you want to do. I suggest you post a new question in the form "On page [X] I want to add content [Y], how can I do that?"
    – Letharion
    Jan 9, 2012 at 15:28

The variables are driven by the templating engine. Check out the Drupal API on page.tpl.php for details of what each variable does.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.