Problem adding new block


Author Message
i7nvd

Posted: 8/18/2011
Quote message 

Hi everyone,

I'm trying to add a new block in a custom position on my page. The block only shows up user pages (domain.com/user/1 user/2 etc), which I have defined. The block looks okay on its own, but the problem is that it overlaps the content in post-content. here's what I've got.

In my theme.info, I added the line:
regions[newblock] = New Block


In my CSS, I did this:
.newblock { 	

z-index: -10;
float: right;
width: 352px;
}


And the line I'm trying to paste into page.tpl.php is this:
<?php if (!empty($skin_preview)) { echo '<div class="skin_preview">'.render($skin_preview).'</div>'; }?><div class="cleared"></div>


First of all, I don't know where to properly place it in page.tpl (i.e. there are many <div class="tp_postcontent"> spots - I'm not sure which one is right.). Sometimes it appears behind the rest of the body text, sometimes it appears over top of the body text, and sometimes it doesn't show up at all. Where do I put it so the rest of the content in postcontent wraps around this div? Did I do something wrong in the coding somewhere?
 
Eric G.

Posted: 9/2/2011
Quote message 

Sounds like a CSS issue. Try setting your CSS to display: block; or position: absolute.

In your page.tpl give this a whirl:
<div class="newblock">
<?php print $newblock?>
</div>

Use Firebug to identify which elements you want before and after the element you're inserting. Hope this helps!

Sincerely,
Eric G.
 
Mark C

Posted: 9/7/2011
Quote message 

Just to be clear as well, you are trying to add a new "region" not a new "block". Regions are places on the website where blocks (of content) are placed.

Just in case you are searching on Drupal.org for "How to add new block" and not getting the results your desire.