_phptemplate_callback

Хочешь помочь с переводом? Это очень просто и быстро. Лишь зарегистрируйся, и можешь тут же начать переводить.

themes/engines/phptemplate/phptemplate.engine, строка 54

Версии
5
_phptemplate_callback($hook, $variables = array(), $suggestions = array())

Производит запрос к движку темизации.

Каждое обращение к движку темизации состоит из двух шагов — подготовки переменных и совершения действий над ними.

Первый шаг выполняется всеми движками или темами, а второй зависит от конкретного движка темизации.

Параметры

$hook Название используемой функции темизации.

$variables Последовательный массив переменных, которые передаются в функцию темизации.

$suggestions Массив предполагаемых названий шаблонов. Если ни однин из этих файлов не найден, будет использован файл $hook.tpl.php

Возвращаемое значение

HTML-код, созданный шаблонным движком.

▾ 5 функции вызывают _phptemplate_callback()

phptemplate_block in themes/engines/phptemplate/phptemplate.engine
Prepare the values passed to the theme_block function to be passed into a pluggable template engine. Uses block properties to generate a series of template file suggestions. If none are found, the default block.tpl.php is used.
phptemplate_box in themes/engines/phptemplate/phptemplate.engine
Prepare the values passed to the theme_box function to be passed into a pluggable template engine.
phptemplate_comment in themes/engines/phptemplate/phptemplate.engine
Prepare the values passed to the theme_comment function to be passed into a pluggable template engine.
phptemplate_node in themes/engines/phptemplate/phptemplate.engine
Prepare the values passed to the theme_node function to be passed into a pluggable template engine.
phptemplate_page in themes/engines/phptemplate/phptemplate.engine
Prepare the values passed to the theme_page function to be passed into a pluggable template engine. Uses the arg() function to generate a series of page template files suggestions based on the current path. If none are found, the default page.tpl.php...

Код

<?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);
  }

}
?>
Войдите или зарегистрируйтесь, чтобы получить возможность отправлять комментарии

Вход в систему