开发者

Drupal template overwrite

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 ov开发者_运维知识库erwrite it in my theme file template.php? If I can, could you give me an example of how to do it?


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜