views:

31

answers:

1

I need to theme tabs on a certain number of pages "user/*". If i simply use theme_menu_local_task in template.php, it will use the function on all pages, not only on "user/*". Is there a way to theme only "user/" pages and leave others alone?

A: 

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.

farzan
WOrks great, stupid me didn't think to use IF in the function, not before the function.I've also modified it a bit, to use if(arg(0) == 'user') for example, so all paths that start with user/ will get it.
Djeux