简体   繁体   中英

Drupal 6 How to override theme function defined in module?

I'm using Taxonomy Browser Module and I'm trying to override the following theme function theme_taxonomy_browser_page which is in taxonomy_browser.module. So I wrote the following function in template.php:

function mytheme_taxonomy_browser_page($form) {
    return "Inside";
}

However, it isn't replacing anything with "Inside" on the page. What could I be doing wrong?

I have cleared cache. Please help me.

Which cache have you cleared?

Theme cache is a bit separated, try to submit the theme selections form at /admin/build/themes.

Might be a silly point but it helpss me make sure my code is being called... try using

drupal_set_message('inside');

It often helps me track down typos or misunderstanding of what is going on in my own admittedly limited Drupal development.

Just an observation in case somebody has the same issue as I had: If the theme you're going to override is going to be used for an administration menu you might be in for a surprise to discover that you have an additional template.php file. I had a sub-theme of Zen as the site theme, but I was using Garland for the administration menu which comes with it's own template.php file. Needless to say I tried for hours to override in the Zen sub-theme template.php file with no success.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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