Custom Blocks

doubledoh - October 17, 2009 - 01:11
Project:RelatedContent
Version:6.x-1.0-beta1
Component:Code
Category:support request
Priority:normal
Assigned:Unassigned
Status:active
Issue tags:imagecache, related content
Description

I used this code for a related content block (which I found in your handbook):

<?php
<?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);
      }
    }
  }
}
?>

This works great...but it's not very visually stimulating. I would like to also like to display the first thumbnail from inside the image field inside this cck node. It's an imagecache field. Any suggestions?

And while we're at it, what's the best way to reference and display the other fields from inside the node inside this block?

Sorry, this is all probably very easy for you, but I'm not an experience php/drupal person.

Thanks in advance!

#1

doubledoh - October 17, 2009 - 01:13

This is a double post. Please delete me.

 
 

Drupal is a registered trademark of Dries Buytaert.