_phptemplate_callback
themes/engines/phptemplate/phptemplate.engine, строка 54
- Версии
- 5
_phptemplate_callback($hook, $variables = array(), $suggestions = array())
Производит запрос к движку темизации.
Каждое обращение к движку темизации состоит из двух шагов — подготовки переменных и совершения действий над ними.
Первый шаг выполняется всеми движками или темами, а второй зависит от конкретного движка темизации.
Параметры
$hook
Название используемой функции темизации.
$variables
Последовательный массив переменных, которые передаются в функцию темизации.
$suggestions
Массив предполагаемых названий шаблонов. Если ни однин из этих файлов не найден, будет использован файл $hook
.tpl.php
Возвращаемое значение
HTML-код, созданный шаблонным движком.
Код
<?php
function _phptemplate_callback($hook, $variables = array(), $suggestions = array()) {
global $theme_engine;
$variables = array_merge($variables, _phptemplate_default_variables($hook, $variables));
// Allow specified variables to be overridden
$variables_function = '_'. $theme_engine .'_variables';
if (function_exists($variables_function)) {
$variables = array_merge($variables, call_user_func($variables_function, $hook, $variables));
}
if (isset($variables['template_files'])) {
$suggestions = array_merge($suggestions, $variables['template_files']);
}
if (isset($variables['template_file'])) {
$suggestions[] = $variables['template_file'];
}
$hook_function = '_'. $theme_engine .'_'. $hook;
$default_function = '_'. $theme_engine .'_default';
if (function_exists($hook_function)) {
return call_user_func($hook_function, $variables, $suggestions);
}
elseif (function_exists($default_function)) {
return call_user_func($default_function, $hook, $variables, $suggestions);
}
}
?>
Войдите или зарегистрируйтесь, чтобы получить возможность отправлять комментарии