Drupal Block Visibility: Check Node Type


/ Published in: PHP
Save to your folder(s)

From Drupal 5 Themes book.


Copy this code and paste it in your HTML
  1. <?php
  2. $match = FALSE;
  3. $types = array('story' => 1);
  4. if (arg(0) == 'node' && is_numeric(arg(1))) {
  5. $nid = arg(1);
  6. $node = node_load(array('nid' => $nid));
  7. $type = $node->type;
  8. if (isset($types[$type])) {
  9. $match = TRUE;
  10. }
  11. }
  12. return $match;
  13. ?>

URL: http://www.packtpub.com/drupal-5-themes/book

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.