Displaying CCK content in Drupal Views RSS

09 December 2009 by jay boodhun 0 Comments

The only thing that shows up using the built-in configuration in Views RSS is the non-cck parts of a node, namely Title ,Body and Teaser.
So after a lot of digging around on Drupal forums i cam across this solution which seems to work pretty well.

Views does not currently support this, though it may in the future. It basically requires making a variant of the node_rss style plugin that uses fields and puts them in.
For the time being the solution below does the trick.

function helpers_nodeapi(&$node, $op, $a3 = NULL, $a4 = NULL) {
    switch($op) {
        case 'rss item':    
           if($node->type=='gm_article') {  
               $node->title = $node->title;
               $node->teaser = $node->field_brief_description[0]['view'];
           }
           if($node->type=='gm_today_article') { 
                $node->title = $node->title;
                $node->teaser = $node->field_gmt_brief[0]['view'];
            }
             if($node->type=='lng_article') {        
                     $node->title = $node->title;
                     $node->teaser = $node->field_lng_brief[0]['view'];
            }
        break;
  }
}