简体   繁体   English

Drupal 7. 如何将一块可重复使用的 html(或块)添加到主内容字段

[英]Drupal 7. How to add a piece of reusable html (or a block) to the main content field

My website is built with Drupal 7. I created a block containing an html table that I would like to add to selected pages via a content field accepting html or php code. My website is built with Drupal 7. I created a block containing an html table that I would like to add to selected pages via a content field accepting html or php code.

I know how to add blocks to regions, but I can't find if I can add reusable html blocks inside fields (ie page content itself)我知道如何向区域添加块,但我找不到是否可以在字段内添加可重复使用的 html 块(即页面内容本身)

You could print your block(s) from code like:您可以从以下代码打印您的块:

<?php
  $block = module_invoke('module_name', 'block_view', 'block_delta');
  print $block['content'];
?>

https://drupal.stackexchange.com/questions/121650/render-custom-block-by-block-name https://drupal.stackexchange.com/questions/121650/render-custom-block-by-block-name

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM