如何知道在 drupal 7 中分配区域数据的位置

How to know where to assign regions data in drupal 7

我对 drupal 7 中的区域有疑问。这是我的主题中 page.tpl.php 文件的代码。我已经在主题文件夹内的 leadsnow.info 文件中声明了这些区域。但是不知道如何使用它们。就像如果我想在一个区域内保留一块 html 标签,那么我该怎么做。我是否需要创建任何文件并将这些 div 放在某个文件中,如果是这样请指导我。我是 drupal 的新手,想从自定义原始 html 文件创建一个 drupal 主题。请帮忙。

//======page.tpl.php==========
<?php if ($page['header']): ?>    
  <?php print render($page['header']); ?>
<?php endif; ?>

  <?php  print render($page['content']);

  <?php print render($page['footer']); ?>

在 Page.tpl.php 中,您只能根据需要将您的区域包裹在自定义 HTML 中。 喜欢

<div class="header-wrapper">
<?php if ($page['header']): ?>    
  <?php print render($page['header']); ?>
<?php endif; ?>
</div>

如果您想在您所在的地区添加 HTML,则必须创建另一个模板文件。

在此处阅读主题挂钩建议 https://www.drupal.org/node/1089656 你会更清楚模板的工作方式。

谢谢。

经过一些研究和开发工作,我得出了这一点。我们一般在out page.tpl.php page 中声明要使用的区域。之后,如果我们想在任何区域显示任何数据,我们必须通过一些块来实现,为此我们必须从管理面板创建一个块并为其分配一些区域。然后我们可以为该区域的那个块创建一个 .tpl 文件并获取数据并显示它。我想,这就是在 Drupal 中完成的方式。