Drupal 7 - How to load a template file from a module?

前端 未结 5 567
时光说笑
时光说笑 2021-02-08 04:06

I am trying to build my own module in Drupal 7.

So I have created a simple module called \'moon\'

function moon_menu() {
  $items = array();
      $items         


        
5条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2021-02-08 04:40

    For your own stuff (not overriding a template from another module)?

    Sure, you only need to:

    • Register your template with hook_theme()

    • Call theme('moon', $args)

    $args is an array that contains the arguments to the template as specified by your hook_theme() implementation.

提交回复
热议问题