简体   繁体   English

在Drupal中设置某些页面的主题

[英]Theming certain pages in drupal

I need to theme tabs on a certain number of pages "user/ ". 我需要在一定数量的页面“ user / 上设置主题标签 If i simply use theme_menu_local_task in template.php, it will use the function on all pages, not only on "user/ ". 如果我只是在template.php中使用theme_menu_local_task,它将在所有页面上使用该函数,而不仅仅是在“ user / ”上。 Is there a way to theme only "user/" pages and leave others alone? 有没有一种方法可以仅将“用户/”页面作为主题,而将其他页面搁置?

Here is an approach: 这是一种方法:

function mytheme_menu_local_task($link, $active = FALSE) {
    // for paths you want to override the theme:
    if ($_GET['q'] == 'certain/path') {
        return '... my theme ...';
    }
    // for other _normal_ paths:
    else {
        return theme_menu_local_task($link, $active);
    }
}

Note you have to call return theme_menu_local_task() directly or your code will trapped in an infinite recursive calls. 请注意,您必须直接调用return theme_menu_local_task(),否则您的代码将陷入无限的递归调用中。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM