KWorrall
KWorrall

Reputation: 420

Drupal 7 - Wanting content (of certain content-type) to appear in block

I have recently started on Drupal (v 7) to create a small company website.

After much reading and watching tutorials, I have started to create my new theme from scratch. I have defined regions and customised the page.tpl.php file to place them into the template (and node.tpl.php etc). All these changes are working and the layout is looking good, and any item I add appears in the main content output.

In my footer region, I have created a block in which I would like links to appear. I have also created a content-type called footer links (with relevant fields) and I have created a couple items of content for it.

The block is showing fine (the title and block body appear). However, despite scouring the documentation, I am not sure what needs to be done to make the items of content (footer links) appear in this block.

Any help appreciated, thanks!

info file snippet for a region

regions[footer_one] = Footer Column One

... and code in page.tpl.php

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

Upvotes: 0

Views: 2614

Answers (2)

Oranges13
Oranges13

Reputation: 1084

Views is really powerful and sounds like it will do exactly what you need. Otherwise, you can create a menu for your items and place that menu in your region as well.

Regarding your original code, you'd probably need to grab the information about the nodes from the database in order to construct a list on your own, but views basically does that for you :)

Upvotes: 0

soju
soju

Reputation: 25312

If you just need simple footer links, no need to create a content type for this, you can simple create a menu and add a menu block in footer.

If you really want to use your own content type for these links, you can create a view (with views module) to display what you want in a block.

About creating a theme from scratch, did you try before to create a sub theme ?

PS: I don't think drupal is a good cms for "small company website".

Upvotes: 1

Related Questions