Breaking News
Home / Webmaster / How to hide a Drupal block based on post url?

How to hide a Drupal block based on post url?

Drupal Blocks URL BasedDurpal provides various options 3 options to include a block based on the post url. Normally the first two are good enough however if you need more control you can use the third option i.e. writing a php block of code to return TRUE or FALSE implying whether to display or not display the block.

For example, if you don’t want to display a block on url like admin/* , user/* & forum/* you can use the following snippet.

<!><?php
$match = TRUE;
$url = request_uri();
$pages = array(‘admin’, ‘user’, ‘home’);
foreach($pages as $page){
if (strpos($url, $page)) {
  $match = FALSE;
}
}
return $match;
?>

The following is the screenshot of the same this time as defined in the block configuration.

Selective include Drupal Block

[pb_builder]

Check Also

How to reset forgotten password for PHPMotion Admin User?

Solution Basically if you forgot the ‘admin’ user password of the your PHPMotion website. Most …

Advertisment ad adsense adlogger