Take the 2-minute tour ×
Drupal Answers is a question and answer site for Drupal developers and administrators. It's 100% free, no registration required.

There is a function in Drupal 5 (_phptemplate_variables()) that has been deprecated in Drupal 6. Is there a similar function in Drupal 6?

share|improve this question
2  
It seems to me that your question title doesn't match with what you explain in the body... Could you please clarify? –  acm Mar 14 '11 at 14:15
    
For those of you looking for Equivalent function in D6 and above, look at GoogleTorp's answer. –  GoodSp33d Apr 1 '13 at 7:52
add comment

4 Answers 4

up vote 4 down vote accepted

well, i'm not totally sure what you mean, but according to the title of the post, you want a redirect function ?

something like the drupal_goto(); function?

http://api.drupal.org/api/drupal/includes--common.inc/function/drupal_goto/6

share|improve this answer
add comment

_phptemplate_variables in D5 have been changed into multiple functions.

The Drupal preprocess functions have changed from Drupal 5 -> Drupal 6, to make them hook based. So instead of having a single function that could be invoked for different hooks, Drupal 6 uses the naming system similar to how hooks is used in modules.

This is described in detail on Drupal.org: Converting 5.x themes to 6.x

share|improve this answer
add comment

_phptemplate_variables() is not a function that has been deprecated. It is simply a private function that is not used anymore.

Drupal 5 PHPTemplate engine looked for a function with that name to alter the variables used in a template.

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));
    // …
  }
  // … 
}

What the code for Drupal 6 needs to do is to implement MODULE_preprocess(&$variables), or MODULE_preprocess_HOOK(&$variables) (where HOOK is page, node, comment, or any of the values defined from a theme or module).

share|improve this answer
add comment
function phptemplate_preprocess_page(&$variables) {
  if (isset($variables['node'])) {
    $variables['template_files'][] = 'page-' . str_replace('_', '-', $variables['node']->type);
  }
  return $variables;
}
share|improve this answer
1  
OP is asking for Equivalent of _phptemplate_variables() –  Nikhil M Dec 14 '12 at 16:31
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.