[英]Drupal 7: print field to region in node--type.tpl.php file
In Drupal 6, it was so easy to print content to an existing region using the following: 在Drupal 6中,使用以下命令将内容打印到现有区域非常容易:
<?php
drupal_set_content('left-sidebar', $field_MY_FIELD_rendered);
?>
I've been searching and searching for how to do this in Drupal 7 after finding out drupal_add_region_content()
doesn't work and I'm at a loss. 在发现drupal_add_region_content()
不起作用并且感到茫然之后,我一直在Drupal 7中搜索并搜索如何执行此操作。
I can get the exact output I'm looking for using $output = render($content['field_MY_FIELD']);
我可以使用$output = render($content['field_MY_FIELD']);
获得所需的确切输出$output = render($content['field_MY_FIELD']);
, but I see no way to output that to a block without having to write a hook in a separate module or some such thing. ,但是我看不到不必在单独的模块中编写钩子或类似的东西将其输出到块的方法。
Any ideas on how to output $output to a region using node--type.tpl.php? 关于如何使用node--type.tpl.php将$ output输出到区域的任何想法?
Thanks in advance, 提前致谢,
Dan 担
您是否尝试将field--field_myfield.tpl.php放入模板目录?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.