Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/drupal/3.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
Drupal 7:将字段打印到节点--type.tpl.php文件中的区域_Drupal_Drupal 7_Drupal Theming - Fatal编程技术网

Drupal 7:将字段打印到节点--type.tpl.php文件中的区域

Drupal 7:将字段打印到节点--type.tpl.php文件中的区域,drupal,drupal-7,drupal-theming,Drupal,Drupal 7,Drupal Theming,在Drupal 6中,使用以下方法将内容打印到现有区域非常容易: <?php drupal_set_content('left-sidebar', $field_MY_FIELD_rendered); ?> 在发现Drupal\u add\u region\u content()不起作用后,我一直在搜索如何在Drupal 7中做到这一点 我可以使用$output=render($content['field\u MY\u field'])获得我想要的确切输出,但我认为不必在

在Drupal 6中,使用以下方法将内容打印到现有区域非常容易:

<?php
  drupal_set_content('left-sidebar', $field_MY_FIELD_rendered);
?>


在发现
Drupal\u add\u region\u content()
不起作用后,我一直在搜索如何在Drupal 7中做到这一点

我可以使用
$output=render($content['field\u MY\u field'])获得我想要的确切输出,但我认为不必在单独的模块或类似的东西中编写钩子,就无法将其输出到块

关于如何使用node--type.tpl.php将$output输出到区域,您有什么想法吗

提前感谢,


Dan

您是否尝试将字段--field\u myfield.tpl.php放在模板目录中?

drupal\u add\u region\u content()
工作正常(core本身使用函数将页面内容分配到必要的区域)。你从哪里打过来的?@Clive,谢谢,但我认为它只适用于core(请参阅)。我从node-type.tpl.php调用它。