【问题标题】:Drupal 7. How to add a piece of reusable html (or a block) to the main content fieldDrupal 7. 如何在主内容字段中添加一段可重用的html(或块)
【发布时间】:2021-01-15 12:29:54
【问题描述】:

我的网站是用 Drupal 7 构建的。我创建了一个包含 html 表的块,我想通过接受 html 或 php 代码的内容字段将其添加到选定的页面。

我知道如何向区域添加块,但我不知道是否可以在字段中添加可重用的 html 块(即页面内容本身)

【问题讨论】:

    标签: drupal drupal-7


    【解决方案1】:

    您可以通过以下代码打印您的块:

    <?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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-10-13
      • 2016-09-11
      • 1970-01-01
      • 1970-01-01
      • 2017-11-25
      • 1970-01-01
      相关资源
      最近更新 更多