基本上我创建了一个网络表单并将其作为一个块启用,现在我想将该块放在一个特定的节点中。我可以通过将其放置在“内容”区域并定义特定节点但它显示在内容末尾来做到这一点。现在如何在内容中的特定元素之间移动它?
该节点正在使用页面类型....tpl.php,它也被其他 5 个节点使用,因此我无法更改代码。
可视化它看起来像:
[ 内容 ]
-描述文本-
-视频列表-
[内容结束]
我需要将我的网络表单放在文本和视频列表之间。有办法吗?
基本上我创建了一个网络表单并将其作为一个块启用,现在我想将该块放在一个特定的节点中。我可以通过将其放置在“内容”区域并定义特定节点但它显示在内容末尾来做到这一点。现在如何在内容中的特定元素之间移动它?
该节点正在使用页面类型....tpl.php,它也被其他 5 个节点使用,因此我无法更改代码。
可视化它看起来像:
[ 内容 ]
-描述文本-
-视频列表-
[内容结束]
我需要将我的网络表单放在文本和视频列表之间。有办法吗?
你可以走很多路,但既然你说你正在考虑模板文件:为什么不使用节点特定的模板,因为page
是节点类型?
假设您在 node/123 上,那么您可以使用一个名为node--123.tpl.php
(参见Drupal 7 Template (Theme Hook) Suggestions)的模板并将您的块嵌入其中。
或者,您可以通过hook_token_info在自定义模块中提供可重用的令牌,并将其与常用的token_filter模块结合使用。但这可能是最重要的,如果它只是你需要触摸的一个节点。
For Drupal 7 a bit of a hacky way to display the contents of a block in content would be to enable the PHP Filter module. Then edit your node and switch to the PHP code Text format and add this code
<?php
$block = module_invoke('block', 'block_view', '1');
print render($block['content']);
?>
where '1' is the block id found in the URL when you edit the block and be sure to include the PHP tags.
Also see this page https://www.drupal.org/node/26502 for more information on placing blocks.