I need to display a nav block based on category OR a node id. I've got the category part working, but when I view the content for this node (http://www.example.com/?q=node/1), the block is not displayed. Any ideas on what I'm missing?


<?php

$match = FALSE;
if (arg(0) == 'node' && is_numeric(arg(1))) {
$nid = arg(1); 
$type = db_result(db_query("SELECT type FROM {node} WHERE nid=$nid"));
  if ($type == 'flexinode-1') {
    $match = TRUE;
  }
}
elseif(nid == 1) {
  $match = TRUE;
}
else {
  $match = FALSE;
}
return $match;

?>

Comments

heine’s picture

Because it was in your elseif clause

$match = FALSE;
if (arg(0) == 'node' && is_numeric(arg(1))) {
  $nid = arg(1); 
  if ($nid == 1) {
    $match = TRUE; // or return TRUE;
  }
  else {
    $type = db_result(db_query("SELECT type FROM {node} WHERE nid=%d", $nid));
    if ($type == 'flexinode-1') {
      $match = TRUE; // or return TRUE;
    }
  }
}
return $match; // or return FALSE;

--
The Manual | Troubleshooting FAQ | Tips for posting | Make Backups! | Consider creating a Test site.

cschall’s picture

Thanks for your help! :)