0
votes

One template which is output by a tpl.php template file in hook_theme (eg:book-navigation.tpl.php). Could i use the preprocess function to overwrite it in my theme file template.php? If I can, could you give me an example of how to do it?

1

1 Answers

1
votes

Add this code into template.php:

function phptemplate_preprocess_book_navigation(&$vars) {
  if (WRITEHERE_YOUR_CONDITION_WHEN_YOU_WANTTO_CHANGE_TEMPLATE) {
    $vars['template_files'][]  = 'book-navigation-spec';
  }
}

Copy book-navigation.tpl.php to your theme folder.
create book-navigation-spec.tpl.php (take source from first file), and write your changes.
Clear cache.