Display a block on certain pages by url and by node type.
<?php
$match = FALSE;
$types = array('content_type_one' => 1, 'content_type_two' => 2);
if (arg(0) == 'node' && is_numeric(arg(1))) {
$nid = arg(1);
$node = node_load(array('nid' => $nid));
$type = $node->type;
if (isset($types[$type])) {
$match = TRUE;
}
}
$desired_paths = array('page1', 'page2');
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);
foreach ($desired_paths as $desired_path) {
if (stristr($my_path_alias, $desired_path)) {
$match = TRUE;
}
}
return $match;
?>
Thank you for sharing information like this. It’s very useful to me. Visit www.mgupload.net for more information about data mapping
Lao
www.mgupload.net
I'm impressed. You're truly well informed and very intelligent. You wrote something that people could understand and made the subject intriguing for everyone. I'm saving this for future use.
Vivian
Marks Web
www.imarksweb.net
Post new comment