Reply to comment

Use this function if you want to pass extra variables to a tpl.php file.
Forexample :
You want to pass a variable to page.tpl.php. Put in template.php this function.

function phptemplate_preprocess_page(&$variables) {
  $variables['my_var'] = '<span>this is my var</span>';
}

In your page.tpl.php $my_var will be available.

If you call it without page in the function $my_var will be available in every theme function that is being called.

function phptemplate_preprocess(&$variables) {
  $variables['my_var'] = '<span>this is my var</span>';
}

The lower functions can override the above functions.
The hierarchy of the functions :

 
template_preprocess()
template_preprocess_page()
yourmodulename_preprocess()
yourmodulename_template_preprocess_page()
phptemplate_preprocess()
phptemplate_preprocess_page()
yourthemename_preprocess()
yourthemename_preprocess_page()

More on theming can be found on http://api.drupal.org/api/function/theme/6

Reply

The content of this field is kept private and will not be shown publicly.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd><img><p><b><i><table><th><tr><td><blockquote><br /><img /><tbody><span><strike>
  • Lines and paragraphs break automatically.
  • You can enable syntax highlighting of source code with the following tags: <codes>, <blockcode>, <c>, <cpp>, <drupal5>, <drupal6>, <java>, <javascript>, <php>, <python>, <ruby>. The supported tag styles are: <foo>, [foo].
  • Web page addresses and e-mail addresses turn into links automatically.

More information about formatting options

Type the characters you see in this picture. (verify using audio)
Type the characters you see in the picture above; if you can't read them, submit the form and a new image will be generated. Not case sensitive.