Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/296.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php Drupal 7节点内容类型模板路径_Php_Drupal_Drupal 7_Drupal Modules_Drupal Templates - Fatal编程技术网

Php Drupal 7节点内容类型模板路径

Php Drupal 7节点内容类型模板路径,php,drupal,drupal-7,drupal-modules,drupal-templates,Php,Drupal,Drupal 7,Drupal Modules,Drupal Templates,我正在为Drupal7开发一个模块。我将我的内容类型的模板定义为node--[content type].tpl.php,并将其放置在“themes/[selected theme]/template”目录中。我想将此模板保留在我的“模块”目录中。因此,在安装模块时,我不必每次都将文件放入选定的主题文件夹中。有办法做到这一点吗 提前谢谢大家 我只有不到10个代表,所以我不能回答我自己的问题,所以我将修改问题 下面是一些如何为我工作。对于案例节点编辑表单视图和节点视图 function [cont

我正在为Drupal7开发一个模块。我将我的内容类型的模板定义为node--[content type].tpl.php,并将其放置在“themes/[selected theme]/template”目录中。我想将此模板保留在我的“模块”目录中。因此,在安装模块时,我不必每次都将文件放入选定的主题文件夹中。有办法做到这一点吗

提前谢谢大家

我只有不到10个代表,所以我不能回答我自己的问题,所以我将修改问题

下面是一些如何为我工作。对于案例节点编辑表单视图和节点视图

function [content type]_theme() {
   return array(
    '[content type]_node_form' => array(
          'arguments' => array(
              'form' => NULL,
            ),
        'template' => 'node--[content type]--edit',
        'render element' => 'form',
        ),
    'node__[content type]' => array (
          'variables' => array(),
          'template' => 'node--[content type]' ,
          'base hook' => 'node',
          'path' => "sites/all/modules/[content type]_update/[content type]_update/[content type]/",
        ),
    );
}

我不完全理解这一点,但它正在发挥作用。

此链接应该可以帮助您:

您基本上希望创建一个新的自定义主题。
除了上面的教程之外,创建一个新文件夹“templates”,并在其中添加.tpl文件,而不是核心主题文件夹。

您可以使用以下格式指定模板路径。然后,您可以将tpl文件放在模块文件夹中

function MODULENAME_theme() {
    return array(
        'yourcustom_theme' => array(
            'template' => 'mypage', // template file called mypage.tpl.php
            'path' => drupal_get_path('module', 'MODULENAME'),
        )          
    );
}

实际上,在我之前有人做过这个模块。他创建了一个模板节点--[content-type]--edit.tpl.php,该节点附加到[content-type]的编辑表单。我找到了一个this code
函数[content type]\u theme(){return array('[content type]\u node\u form'=>array('arguments'=>array('form'=>NULL,),'template'=>'节点--[content type]--edit','render element'=>'form',);}
我不知道如何对我的节点[内容类型]视图执行类似操作您需要将path元素添加到数组中。这可能有助于: