Drupal Tutorials > Blocks > Show Drupal blocks only on specific pages with PHP code

Show Drupal blocks only on specific pages with PHP code

categories: Blocks
for Drupal: D5D6
0

Drupal blocks are the basic building elements of any Drupal page. Blocks are placed in block regions and they serve different purposes from showing a list of elements even to show a picture or a video.

Menus of the Drupal system are also blocks of special kind that show links to other drupal nodes/pages/url or external links. (I assume that you know about drupal blocks and how they can be shown or hidden on basic given conditions and also you have some knowledge of php.)

Having a look at a block's configuration page (Site Building >> Blocks >> List) and clicking configure aside one of the block descriptions there are various ways to control the visibility of a particular Drupal block.Some are let users control what they see, to show only to block to only specific roles.

The Need

In page specific visibility the first two options are quite clear, you want to show a particular block in some url and its sub URL like setting to option 2 : "Show on only the listed pages." and typing the following on pages:

(Show Drupal blocks only on specific pages with PHP code >>)

ingridients (modules): block

Comments

Post new comment

The content of this field is kept private and will not be shown publicly.
233 Drupal Tutorials and counting!