The Beat blocks enabled for Beat Node view

tags:

Nick came to me on Thursday and asked to have The Beat by Topic and The Beat Archives displayed on the node views of The Beat

It took some thinking, but I figured it out.

The Beat by Topics is a Nice_Menu, so I created a block called Beat by Topic (for Beat entries) (Nice Menu) and put it in the left sidebar.

I then selected "Show if the following PHP code returns TRUE (PHP-mode, experts only)." from the bottom of the dialog and put in the following PHP code to have it show up only on entries of The Beat and nowhere else

 

<?php
  // Only show if $match is true
  $match = false;

  // Which node types
  $types = array('the_beat_entry');

  // Match current node type with array of types
  if (arg(0) == 'node' && is_numeric(arg(1))) {
    $nid = arg(1);
    $node = node_load(array('nid' => $nid));
    $type = $node->type;
    $match |= in_array($type, $types);
  }

  return $match;
?>


 

The Beat Archives is built off of a view, so I created a new block, called The Beat Archives (for nodes) and put in the same PHP code.

National Clearinghouse on Families & Youth | P.O. Box 13505 | Silver Spring, MD 20911-3505 | (301) 608-8098 | ncfy@acf.hhs.gov