9

How do I assign a block (the very same block) twice or thrice to different regions? The idea is not to have the same block on the same page more than once, but in different locations on different pages, so four 'displays' would be available:

  • Block X in the $top_left region
  • Block X in the $top_right region
  • Block X in the $above_content region
  • Block X hidden

Where it should be located, should be as simple as adding node paths in the textare, right? I understand that's what it's for...

If it's a module (please god no, not another module!), I'd like a few details.

Thanks.

apaderno
  • 28,547
  • 16
  • 75
  • 90
Rudie
  • 52,220
  • 42
  • 131
  • 173
  • What method do you aim to use to determine which page you are on, and therefore where the block will show? For example, do you want to show the block in a different location by content/node type? Or based on part of the URL? – CitrusTree Aug 21 '10 at 19:08
  • CitrusTree, the page/location is enough information. That's what I use for blocks. Sometimes even only and [the rest]. So based on the URL. Like with the textarea that's standard in the standard blocks page. – Rudie Aug 23 '10 at 06:00
  • http://drupal.org/project/multiblock module do the job. – gagarine Aug 21 '10 at 19:56

2 Answers2

13

You'll want to look into the Context module, which will let you assign blocks based on sets of conditions. You create a context, set up a couple of conditions, then create a reaction to those conditions where your block appears.

So, let's say you wanted to show Block X on the front page and when a user is logged in. When it's the front page Block X is in Region 1, but when the user is logged in, Block X is in Region 2.

You'd create two contexts:

  1. Conditions: Is Front Page, User is anonymous, Reactions: Show Block X in Region 1
  2. Conditions: User is logged in, Reactions Show Block X in Region 2

I'm generalizing here, but you'll see what conditions and reactions are available for use when you install Context.

  • I've heard about Context, but couldn't find where to setup those blocks. I understand the conditions. Very clear. Sounds like it should have been a Drupal core module. Where can I find the Context's interface? :) Thanks – Rudie Aug 23 '10 at 05:57
  • If you downloaded it, besides *Context*, you need to enable *Context UI*. Then, you can access the the UI at *Site Building* -> *Context*. –  Aug 23 '10 at 07:26
  • By the way: I tried Context but there's a conflict or something if you use Zen as a basetheme (and there's a fix which I used and now I love Context!) – Rudie Sep 14 '10 at 19:03
0

We can make use of Multiblock module rather than using context. It serves your purpose better

Amey Mudras
  • 185
  • 5
  • Context was perfect. Multiblock has new moddelta's, so block class etc have to be duplicated too. – Rudie Apr 22 '14 at 21:29