Hi folks !

I'm new to drupal and working on my first website with it.

I have a problem with how to access a variable defined in page.tpl.php in my node.tpl.php template. I tried with phptemplate_preprocess but I don't know how to interact with it to send my var and its value to be reachable in my node.tpl.php template.

How can i achieve such thing ?

Comments

prakashp’s picture

To make variables available to node.tpl.php, you will have to implement the preprocess function for the node template.

For example in the template.php file of your theme

// replace yourtheme with the name of your theme.
function yourtheme_preprocess_node(&$vars) {
  $vars['some_var'] = 'test';
}

You can now use $some_var in your node.tpl.php