We Recommend

Wicked Cool PHP: Real-World Scripts That Solve Difficult Problems Wicked Cool PHP: Real-World Scripts That Solve Difficult Problems
Wicked Cool PHP contains a wide variety of scripts to process credit cards, check the validity of email addresses, template HTML, and serve dynamic images and text.


Posted By

shrop on 07/07/08


Tagged

drupal


Versions (?)


Who likes this?

4 people have marked this snippet as a favorite

basicmagic
riz
aleprieto
wza


Drupal Block Visibility: Check Node Type


Published in: PHP 


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

From Drupal 5 Themes book.

  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. ?>

Report this snippet 

You need to login to post a comment.