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.
I want to display a block which should ideally appear in the <?php print $content?>
are of a node.
The block is already there and assigned to a region.
The problem I am having is inserting that region into the +body output+. The problem is that nothing shows.
I am using the following in Affect body output
<?php if ($regionname) { ?>
<?php print $regionname;?>
<?php } ?>
Comments
Comment #1
jrglasgow CreditAttribution: jrglasgow commentedWhich block are you trying to add to the body? Can you give me an example to work with, it is much easier for me to think when I have an example.
Also this code is much cleaner than the code you have listed.
Comment #2
jrglasgow CreditAttribution: jrglasgow commentedsince this has ben inactive for 33 weeks I am going to mark this closed.
Comment #3
mediamash CreditAttribution: mediamash commentedhave to reopen it again
only works for the node template which are located in the theme root, not in the contemplate folder ...
Comment #4
mediamash CreditAttribution: mediamash commentedComment #5
planctus CreditAttribution: planctus commentedHello, is there any way to insert a custom region in a contemplate's node template file?
I mean, as mediamash, i'm speaking about the templates placed inside the contemplate folder in sites/all/contemplates.
In a specific situation i need to use that template instead of a node-nodetype.tpl.php in the theme folder, that specific case is a simplenews' newsletter node type
I was trying to use the usual way , a preprocess function in the template.php with a switch for the node types
but nothing happened, i'm going to investigate if the problem is the theme being used by the template, otherwise i don't know how to do this...
Thanks,
Da.
Comment #6
jrglasgow CreditAttribution: jrglasgow commentedthe
$regions
aren't built for the nodes in the preprocess function, only in the page preprocess function.it looks to me like you might be better served by using panels.
Comment #7
planctus CreditAttribution: planctus commentedYour answer really surprised me...
You can use any theming hook you like to place variables in using a preprocess function...
http://drupal.org/node/223430
I always use this way to place my custom regions in a node template when i need it, so there must be a different explanation and it must depend on the way contemplates' templates are built.
If i place that region in the simplenews-newlsetter-body.tpl.php suggested by simplenews it works fine, indeed, but i need to use the contemplates' template in this case...
I guess that the mediamash's post pointed in the same direction but it was based on drupal 5 while i'm using drupal 6, but the issue should be the same: apparently we can't insert a region inside a contemplates' template file.
Thanks,
Da.