Hi All, I'm new to Drupal and am almost through reading Pro Drupal Development (second edition). I currently run a site I created with the cakephp framework but strongly feel Drupal provides for more efficient expansion so I'm almost ready to make the switch.

My question is: can I, using Drupal's admin interface, pick and choose which pages any given block is shown on? If so, please point me to information on how I would go about doing this. From what I have read, i understand it as the block is either on or off (not controlled on a page by page basis).

I'll be as specific as I can in providing an example usage:

I have a Product Showcase that is user submitted - A visitor (can be anonymous) submits a form telling about their product. The form adds the entry to the database, the administration section is used to approve the listing before publication. On several pages, about 80%, there will be a block that has a few of these product listings. Another page will have all of the product listings and have a search function.

An example of when this would be needed:
Separate pages on the site get sponsored. If a page does not have a sponsor this showcase would be visible; If someone decides to sponsor the page I would like to be able to turn off the product showcase and turn on the advertising.

This would need to be repeatable which is why I'm hoping this functionality is already there and I just don't see it. Because there are several pages on this site that are time sensitive, information in blocks would change somewhat frequently.

I hope I've given enough information, and not too much. Let me know if you have any questions and thank you in advance for any help offered.

Chris

Comments

WorldFallz’s picture

The short answer is, yes, you can. It's in the block visibility settings of the configure block page (click configure for any block listed at admin/build/block). You can specify paths or php code to control visibility.

See PHP block visibility settings handbook page for some info as well as a collection of block visibility snippets.

Alternatively, you can check out the http://drupal.org/project/panels or http://drupal.org/project/composite modules.

dnewkerk’s picture

Look into the Flag module as an option for toggling whether a page is sponsored or not. Flag has a sub-module called Flag Actions which can respond to "Triggers" (comes with Drupal 6) to cause things to happen and either it has or will have integration with Rules module for much more advanced workflow possibilities. Here's info on the Flag API.