Return to Snippet

Revision: 7926
at August 21, 2008 10:15 by aleprieto


Initial Code
<?php
if (arg(0) == 'node' && is_numeric($nid = arg(1))) {
  $host_node = node_load($nid);
  $grouped = relatedcontent_variable_output_grouped($host_node->type);
  if($groups = relatedcontent($host_node, $grouped)) {
    foreach($groups as $group => $nodes) {
      if ($nodes) {
        $links = array();
        foreach($nodes as $node) {
          $links[] = l($node->title, "node/$node->nid");
        }
        $title = relatedcontent_group_title($group, $grouped, $host_node->type);
        print theme('item_list', $links, $title);
      }
    }
  }
}
?>

Initial URL
http://drupal.org/node/218844

Initial Description
This code snippet make use of the API to accomplish a block with links to related content.

Initial Title
Drupal RelatedContent module: Block with links to related content

Initial Tags
module, drupal

Initial Language
PHP