Показывать блок если совпадают термины (1, 2, 4) и/или URL (news):
<?php
$desired_terms = array(1, 2, 4);
$desired_path = 'news';
if ( arg(0) == 'node' and is_numeric(arg(1)) ) {
$node = node_load(arg(1));
foreach ($node->taxonomy as $term) {
if (in_array($term->tid, $desired_terms)) {
return TRUE;
}
}
}
if ($_GET['q']) {
$my_drupal_path = $_GET['q'];
} else {
$my_drupal_path = substr($_SERVER['REQUEST_URI'], 1);
}
$my_path_alias = drupal_get_path_alias($my_drupal_path);
if (stristr($my_path_alias, $desired_path)) {
return TRUE;
}
return FALSE;
?>Не показывать блок если совпадают термины (1, 2, 4) и/или URL (news):
<?php
$desired_terms = array(1, 2, 4);
$desired_path = 'news';
if ( arg(0) == 'node' and is_numeric(arg(1)) ) {
$node = node_load(arg(1));
foreach ($node->taxonomy as $term) {
if (in_array($term->tid, $desired_terms)) {
return FALSE;
}
}
}
if ($_GET['q']) {
$my_drupal_path = $_GET['q'];
} else {
$my_drupal_path = substr($_SERVER['REQUEST_URI'], 1);
}
$my_path_alias = drupal_get_path_alias($my_drupal_path);
if (stristr($my_path_alias, $desired_path)) {
return FALSE;
}
return TRUE;
?>
Comments
Post new comment