By jo1ene on
Why doesn't this work for me? I can't use <front> because I also need the content type logic.
$match = FALSE;
$types = array('resource' => 1); //custom node type
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; //display if recource node
}
}
if ($is_front) {
$match = TRUE; //display if front page, doesn't work as I expect
}
return $match;
Comments
return $match; Is your code
Is your code into a function ? If yes have you tried to insert
at the top of the function ?
M.
Freelancer Senior Drupal Developer -- http://www.ziobuddalabs.it
Global?
I now have this in the block visibility settings...
...and it still doen't work.
Advanced Web Design
$is_front is a template variable
rather than a global variable. This is where it gets added to templates:
http://api.drupal.org/api/function/_phptemplate_default_variables/5
As you can see it contains the output of
drupal_is_front_page()- you could just use that function in your check instead.--
Anton
New to Drupal? | Troubleshooting FAQ
Example knowledge base built with Drupal
use drupal_is_front_page()
This is what I have now and it works fine. Thanks!
Advanced Web Design
I will never stop to learn
I will never stop to learn in this forum :)
M.
Freelancer Senior Drupal Developer -- http://www.ziobuddalabs.it