Drupal:如何主题模块 [英] Drupal: How to theme a module

查看:134
本文介绍了Drupal:如何主题模块的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试主题模块输出。
特别是我正在 http://drupal.org/project/service_links 工作



任何想法如何工作?



提前感谢!

解决方案

一般来说,如果你想主题一个模块,你有几个选择。


  1. 覆盖主题功能。您可以覆盖模块使用/实现的主题功能来更改标记,这种功能的一个示例是 theme_service_links_node_format 。你更改在你的主题的template.php中调用一个名为'your_theme_name_service_links_node_format'的函数,然后在其中自定义标记。


  2. CSS。如果您不需要更改模块输出的实际标记,则只需添加所需的css,将其主题化为您的喜好。


  3. 在某些情况下,它不像Sercive链接是这样的情况,您也可以自己创建模板,并使Drupal使用它们。


  4. 另一种方式,再次看起来不像服务是服务链接就是这样的情况,是在你的template.php中实现预处理函数。如果要更改某些模板变量的生成方式,则需要这样做。



I'm trying to theme a modules output. In particular i'm working on http://drupal.org/project/service_links

Any idea how that works?

Thanks in advance!

解决方案

Generally, if you want to theme a module you have a few options.

  1. Overwrite theme functions. You can overwrite the theme functions that the module uses/implements to change the markup, one example of such a function is theme_service_links_node_format. You change make a function in your theme's template.php called 'your_theme_name_service_links_node_format' and make your custom markup in it instead.

  2. CSS. If you don't need to change the actual markup of a modules output, you only need to add the needed css, to theme it into your liking.

  3. In some cases, it doesn't look like sercive links is such a case, you can also make your own templates, and make Drupal use them instead.

  4. Another way, again it doesn't look like service is service links is such a case, is to implement preprocess functions in your template.php. This is needed if you want to alter how certain template variables are generated.

这篇关于Drupal:如何主题模块的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆