【问题标题】:Block or region themes in Drupal 7Drupal 7 中的块或区域主题
【发布时间】:2014-05-28 19:45:43
【问题描述】:

我不知道如何在 Drupal 7 中将自定义主题添加到区域或块。

这是块--main-column-3.tpl.php

<?php if ($block->subject): ?>
    <h2><a href="what-is-nations.html#jobs"><?php print $block->subject ?></a></h2>
<?php endif;?>

<div class="info-graph-section income">
    <object type="image/svg+xml" data="<?php print path_to_theme(); ?>/images/income.svg">
        <!-- fallback image in CSS -->
    </object>
</div>

<?php if ($block->content): ?>
    <?php print $content ?>
    <p><a href="what-is-nations.html#jobs">Learn More <i class="fa fa-chevron-right"></i></a></p>
<?php endif;?>

这是page.tpl.php

<?php if($page["main-column-3"]): ?>
    <div class="col-lg-4 col-sm-4">
        <?php print render($page["main-column-3"]) ?>

<div class="info-graph-section housing">
    <object type="image/svg+xml" data="<?php print path_to_theme(); ?>/images/housing.svg">
        <!-- fallback image in CSS -->
    </object>
</div>

    </div>
<?php endif; ?>

它被渲染了,但它没有使用我的主题。

我有一个名为 content-column-3 的区域,我在该区域中有一个块。

我在这里缺少什么步骤?

谢谢。

编辑:

我正在尝试将内容放在图像下方,同时将标题保留在图像上方。这就是现在的样子

编辑:.info

name = Nations
description = Nations Drupal Theme
core = 7.x

stylesheets[all][] = css/bootstrap.css
stylesheets[all][] = css/custom-styles.css



regions[content] = Content

regions[content-header] = Content Header
regions[content-main] = Content Main

regions[main-column-1] = Main Column 1
regions[main-column-2] = Main Column 2
regions[main-column-3] = Main Column 3

regions[footer-column-1] = Footer Column 1
regions[footer-column-2] = Footer Column 2
regions[footer-column-3] = Footer Column 3

regions[footer-copyright] = Footer Copyright

features[] = main_menu

【问题讨论】:

  • 您是否在主题 .info 中添加了区域?
  • @MarioAlejandroAraque 是的。
  • 块的id是什么?也许问题与您的块 tpl 的名称有关。尝试重命名模块,例如 block--block-1.tpl.php 用于 id 为 1 的块。
  • @MarioAlejandroAraque 是的,这个名字有点意思。部分问题是我在我的区域使用破折号而不是下划线。谢谢。

标签: php drupal drupal-7


【解决方案1】:

在您的地区名称中使用下划线。不是破折号。

您不能将 if 语句包裹在块内容周围。无论如何,您不应该或不需要。

【讨论】:

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