0
votes

I can't figure out how to added a custom theme to a region or block in Drupal 7.

This is block--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;?>

This is 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; ?>

It gets rendered but it's not using my theme.

I have a region called content-column-3 and I have a block in that region.

What's the step that I'm missing here?

Thanks.

Edit:

I'm trying to put the content below the image while keeping the title above the image. This is what it looks like now

enter image description here

Edit: .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
1
Did you add the region in your theme .info?Mario Araque
@MarioAlejandroAraque Yup.user2477011
What's the id of the block? Maybe the problem is related with the name of your block tpl. Try to rename the module, for example block--block-1.tpl.php for a block with id 1.Mario Araque
@MarioAlejandroAraque Yes, it was kind of the name. Part of the problem was that I was using dashes instead of underscores for my regions. Thanks.user2477011

1 Answers

0
votes

Use underscores in your region names. Not dashes.

You can't wrap an if statement around your block content. You shouldn't want or need to anyway.