theme_render_template
includes/theme.inc, строка 1016
- Версии
- 6
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.
Возвращаемое значение
The output generated by the template.
Код
<?php
function theme_render_template($template_file, $variables) {
extract($variables, EXTR_SKIP); // Extract the variables to a local namespace
ob_start(); // Start output buffering
include "./$template_file"; // Include the template file
$contents = ob_get_contents(); // Get the contents of the buffer
ob_end_clean(); // End buffering and discard
return $contents; // Return the contents
}
?>
Войдите или зарегистрируйтесь, чтобы получить возможность отправлять комментарии