Drupal 6 如何覆盖模块中定义的主题函数?
我正在使用分类浏览器模块,并且尝试覆盖位于taxonomy_browser.module 中的以下主题函数theme_taxonomy_browser_page。所以我在 template.php 中编写了以下函数:
function mytheme_taxonomy_browser_page($form) {
return "Inside";
}
但是,它并没有用页面上的“Inside”替换任何内容。我可能做错了什么?
我已经清除缓存了。请帮我。
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
你清除了哪个缓存?
主题缓存有点分离,尝试在 /admin/build/themes 提交主题选择表单。
Which cache have you cleared?
Theme cache is a bit separated, try to submit the theme selections form at /admin/build/themes.
可能是一个愚蠢的观点,但它帮助我确保我的代码被调用...尝试使用
它经常帮助我追踪打字错误或对我自己承认有限的 Drupal 开发中正在发生的事情的误解。
Might be a silly point but it helpss me make sure my code is being called... try using
It often helps me track down typos or misunderstanding of what is going on in my own admittedly limited Drupal development.
只是一个观察,以防有人遇到与我相同的问题:如果您要覆盖的主题将用于管理菜单,您可能会惊讶地发现您有一个额外的 template.php 文件。我有一个 Zen 子主题作为网站主题,但我使用 Garland 作为管理菜单,它带有自己的 template.php 文件。不用说,我尝试了几个小时来覆盖 Zen 子主题 template.php 文件,但没有成功。
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.