6.x theme.inc theme_render_template($template_file, $variables)
7.x theme.inc theme_render_template($template_file, $variables)

Render a system default template, which is essentially a PHP template.


$template_file: The filename of the template to render. Note that this will overwrite anything stored in $variables['template_file'] if using a preprocess hook.

$variables: A keyed array of variables that will appear in the output.

Return value

The output generated by the template.

2 calls to theme_render_template()
theme_install_page in includes/theme.maintenance.inc
Generate a themed installation page.
theme_update_page in includes/theme.maintenance.inc
Generate a themed update page.


includes/theme.inc, line 1076
The theme system, which controls the output of Drupal.


function theme_render_template($template_file, $variables) {
  extract($variables, EXTR_SKIP);

  // Extract the variables to a local namespace

  // Start output buffering
  include "./{$template_file}";

  // Include the template file
  $contents = ob_get_contents();

  // Get the contents of the buffer

  // End buffering and discard
  return $contents;

  // Return the contents