Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
By CompShack on
I'm trying to add a custom block right below the content of each post BUT can't get the block to print out. This is what i've done so far.
I have added the following to the .info file
regions[left] = Left sidebar
regions[right] = Right sidebar
regions[content] = Content
regions[header] = Header
regions[footer] = Footer
regions[belowPost] = Below Posts
and in my node.tpl.php file just before the last "div" close tag I've added the following:
<?php print $belowPost ?>
The problem is when I assign a block to this region, nothing really prints out on the node. What am I missing?
Thanks for your help.
Comments
I think regions are still only in page.tpl.php by default
I think regions are still only in page.tpl.php by default. You may also want to check out http://drupal.org/node/171224. Check out the list under "A few notes", particularly item 4 about caching of the .info file.
I read that page
I think regions are still only in page.tpl.php by default
Do you know how can I get the custom region to print to node.tpl.php?
I read that page and it doesn't help. I can see my new block in the block administration page but the content assigned to the new block area is not being displayed on the nodes.
I think i need to add something to the template.php file but not sure what. In Drupal 5 i had to modify function _phptemplate_variables($hook, $vars) to load region content assigned via the new blocks.
I have also read this "Keep in mind that the internal names are converted into region variables inside the "page.tpl.php" template automatically." This means outputting the region on node.tpl.php is not done automatically. SO, what am i missing?
-----------------------------------------
Finally, I CMS that I Like!
http://www.CompShack.com
Theme settings (region is
Theme settings (region is "settings" too) are cached in theme registry. Try to disable, and enable again your theme.
__________________________________
My Drupal 6 livin' here
Will try
double post - sorry
Will try
I will try that when i get home tonight, but I don't think this would work the reason being when I put the
print $belowPost
command in page.tpl.php the blog gets printed out ok but when i put it in node.tpl.php it doesn't show on the node at all. Anyone know why?Thanks!
-----------------------------------------
Finally, I CMS that I Like!
http://www.CompShack.com
Still need help plz
Can anyone plz tell me what i'm doing wrong. I just can't get my custom region to print on node.tpl.php - it prints fine on the page.tpl.php though.
this is my code from node.tpl.php
-----------------------------------------
Finally, I CMS that I Like!
http://www.CompShack.com
I GOT IT YEEEEEHHHHHHHHHHHHAAAAAAAAAAAAAAAAAAAAAAAA
i had to add the below code to my template.php and it worked GREAT
-----------------------------------------
Finally, I CMS that I Like!
http://www.CompShack.com
Perfect !!!
Thanks for this post! It works how it should!
Webdesign
Weboldal Készítés Weboldal.biz
Great!
That's what I need! Thanks!
Works also in Drupal 6.6
Thank you very much, it works well in drupal 6.6 and the garland theme.
best wishes from germany, Holger
IT-News und IT-Jobs auf w3Projekt.com
Sweet - here's a similar alternative:
Sweet. There's another article that explains how to do this: http://www.codegobbler.com/drupal-6-how-embed-region-node
Since you don't need to include all regions, there doesn't seem to be a need for the foreach loop. Just declare each variable.
And then just print the variable in your node-______.tpl.php file.
Without the foreach, you need your var name
Mikey,
Your solution didn't work for me until I realized that I needed to put in my variable name instead of $region.
For example:
After that change, I was able to call my custom region from my node template.
got it, thanks a lot
got it, thanks a lot
I'm having the same problem -
I'm having the same problem - trying to print a region in the user profile.
My region is named: staffmenu
Block is named: staff_links
What do I need to put in the above code to make it work? And then place in the user-profile.php?
This isn't working:
tempate.php:
user-profile.php:
Thanks.
Thanks for the code
this saved me loads of time and popped right up in a search!
I [heart] you people...
I really do.
Thanks for this super-simple solution.
Placing region's content/block in drupal6 node.tpl.php
Place this stuff where want to print the regions.
Thanks
Kumar Rahul Sankrit