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.
精彩评论