Posted by thorie79 on July 19, 2007 at 5:48pm
Hello,
Is there a way to choose different block-to-region assignments per node. For example, if I go to Adminster > Site Building > Blocks, then I will be able to select which blocks I want in which region. But this seems to apply globally to all pages.
I actually want different nodes to have different assignments. For example:
node/1 has the "left-sidebar" region with login, calendar, and notebook modules.
node/2 has the "left-sidebar" region with most recent posts, and who's online modules.
How can I do this in Drupal?
Thanks!
Timmy
Comments
Use taxonomy theme, or PHP in page.tpl.php to control position
Block positions are assigned per-theme. However, there are ways to dynamically change the positions.
1) Leave the blocks targeted to the same regions, and switch the visual position of the region based on some logic
You can use logic within page.tpl.php to determine where and how blocks will be positioned, or in the presentation layer, you can have a common page.tpl.php file and pick a different CSS file to position the blocks as required.
2) Install the Taxonomy theme module, and that will enable you to create different arrangements for each theme selection. The different themes in this case will be the same exact them with different names, and using a taxonomy option, you can assign a certain node, or group of nodes to certain terms to control the block arrangement.
Let me know if you need more help with this or other issues
-----
iDonny Productions: Web CMS Design, Development & Web Standards
-----
Donny Nyamweya - USER25.com
I don't think I explained what I am doing clearly...
I am not trying to change the positions or theme.
I would like to use a completely different set of modules, in every different node. I can't seem to assign more than one set of modules to the regions using the administer interface. Is there a way to separately define the modules that go into each one of the regions, PER NODE?
By modules - you mean blocks?
You can specify what individual pages each block displays on. If you click 'configure' on a block (for example Who's Online) you can specify where it should appear under page specific visibility settings. If you only want the block to appear on a specific node, just enter 'node/#' (# being the number of the node you wish it to appear on), and select 'Show on only the listed pages'
------------------------------
http://fraggles.artsci.wustl.edu (Drupal user documentation and development blog)
------------------------------
http://fraggles.artsci.wustl.edu (Drupal user documentation and development blog)
OOooooohhh! I get it now...
Thank you!
I didn't know you can assign a different set of modules/blocks -> regions, when I select different themes! That's great! And I can also potentially add all the possible blocks to each of the regions, then turn them on/off per node using the Taxonomy Theme module.
Finally makes sense.
Thanks
multiple regions
This sounds like something I am trying to accomplish. Assign a block to multiple regions.
Because that sounds like the only way to have a block appear in one region on a certain page, and have it appear in a different region on another page. Like, having the calendar block show up in the right sidebar on most pages...but having it appear in content-bottom on the calendar page. Is this possible with some sort of module?
Matt Bannon
You may want to look into
You may want to look into Panels. http://drupal.org/project/panels
------------------------------
http://fraggles.artsci.wustl.edu (Drupal user documentation and development blog)
Use MultiBlock module
MultiBlock module can help here, it creates multiple instances of a block. It just creates a copy of the existing block and the copy can be assigned to another region. The module can be downloaded from the following link. http://drupal.org/project/multiblock
www.cmswebsiteservices.com
Node specific blocks
I've done this several times. There's no contrib module that I know of that does this so I came up with my own approach. I create custom fields in the content type that "toggle" blocks on and off (checkbox or select list are fine). Then I have a custom module that ties it all together.
They're not assigned to different regions. They're all within one container region, like a sidebar. When hook_block() runs, the fields are tested and if they're turned on, their respective content is pushed into the container region. The content can be just about anything. Just a regular block, or text inserted directly in the custom field, or the content of a view, or a custom query. The possibilities are endless. The custom fields also have a weight parameter, so I can control their order.
There are a few drawbacks. First they're limited to the specific region. Second, while I can expose the control of these blocks to the user in the node admin page, I haven't figured out a way to do this with views. So the configuration of the blocks on view pages is hard coded into the custom module. Third, this approach almost always means you can't turn on block caching.
There's probably a way to overcome these shortcomings, but I haven't had a need yet.
I've been contemplating how I could turn this into a contrib module, but I haven't had the time to tinker with it. It would be fairly complex as I think it would have to be both CCK and Views aware to be of much use.
I stand corrected
Now there is a module that does these. It's beta, but is pretty slick. Check out http://drupal.org/project/node_level_blocks