How can I add a custom block to the content region so it is being showed before the actual content, rather than after it?

Comments

green monkey’s picture

your post wasn't very clear - as to what you want to move up on the node - but I'm going to guess you mean terms and Submitted by stuff

this might not be all that helpful, but I'm learning this as well - and I'll tell what I do, it might be the long way to OZ, but I learn along the way too.

1) the theme you are using is determing this

2) find a theme that does it the way you want

3) then compare the two, when you find the $terms stuff - you're in the right spot.

4) node.template.pho - is generally the file you want (in the theme you are using)

good luck - sorry I didn't have a magic wand answer.

xano’s picture

To be a bit more clear: You can assign blocks to regions. When I assign a block to the content region it is being placed after the content and I would like to have it placed before. (The content is the actual node data.)

gonefishing’s picture

This can be accomplished by editing the page.tpl.php. Create the block but, do not enable it, add the following code to your page.tpl.php. (18 is the number of the block so, you need to find out the number of the block you have created)

<div align="center">
<?php
$block = module_invoke('block', 'block', 'view', '18');
print $block['content'];
?></div>

I can't find the url right now but, the code is in the Handbook.

Chill35’s picture

Yep that's true. Even if you assign a light weight of -10 to the block, in the content region, it will still sink to the bottom, after the "content". Thanks for the tip, gonefishing.

Thank you!!! good to know...

gonefishing’s picture

I used the page.tpl.php because I wanted the block to appear on every page. The same bit of code can be added to node.tpl.php.

Zoologico’s picture

This worked, but it really should be cleaner from the theme.
Thanks.

eeyorr’s picture

You could alternatively add a new region to your theme:

http://drupal.org/node/242107

www.drupalmuseum.com
www.organicsitedesign.com

J_M’s picture

I must be a real dummy cause it doesnt work for me. I've tried in page.tpl and node.tpl and in either case my block keeps on being stuck at the bottom of my content.