0

Say, for example, I want to customize the edit user page, so I have created a user-profile.tpl.php. Is there a way to echo out what the page would be normally? What variables should I have access to?

I have tried var_dumping $node, $form, $page, $content, and $user_profile and all but the last are null...

print render($user_profile); results in a list of profile fields, but not the edit-user page that I get without the tpl file.. (where you can change password, email, etc.

I'm curious for pages/nodes/etc in general, not just this particular one. It's an issue I always struggle with.

1
  • 1
    drupal.org/node/1089656 should get you started, but if you are trying to modify what your user edit page would look like WITH a template, you'd use something along the lines of page--user--edit.tpl.php
    – Jimajamma
    Commented Jan 24, 2013 at 23:25

2 Answers 2

2

To see the array $var / $variable -

echo "<pre>";
print_r($var); //or $variable whichever is applicable.
echo "</pre>";

This will output the entire $var/$variable array in structured manner and you can find out all the data available in your tpl.

Hope that is of some help...

1
  • 1
    You can also add a preprocess function and declare your own variables there in $var['example_var'] = something and that will be available in your tpl as $example_var.
    – SGhosh
    Commented Jan 25, 2013 at 9:18
1

You can simply open the default template (modules/user/user-profile.tpl.php in this case).

The comment at the top of the file should show the variables availible to you.

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.