Prepping data for Drupal Views RSS

190 views Asked by At

I'm using the Views RSS Module and want customize the display a bit more than what's available in the views settings. On the Feed Tab in the Feed Style option section I have assigned the Title and Description etc fields. However there's an image field that's included under the Fields section that I'd like to include inside the Description.

In the views-view-field.tpl.php I've print_r-ed $row and got this...

stdClass Object
(
    [nid] => 23
    [node_title] => Title
    [node_revisions_body] => <p>Test Body</p>
    [node_revisions_format] => 4
    [node_created] => 1294704278
    [node_data_field_feature_img_fid] => 13
    [node_data_field_feature_img_list] => 1
    [node_data_field_feature_img_data] => a:2:{s:3:&quot;alt&quot;;s:0:&quot;&quot;;s:5:&quot;title&quot;;s:0:&quot;&quot;;}
    [view_name] => xml_grid_item_feed:feed_1
)

...how can I use this to combine the image data with the body to output in the RSS feed? For that matter this template file is quite generic and would probably screw up other stuff in the site if I edited here. Where would make more sense than here? Would it be better to use a preprocessor function to combine the two? Thanks.

1

There are 1 answers

1
Matt V. On BEST ANSWER

Under the options for each field in a view, there is a checkbox labeled "Rewrite the output of this field". You can use that to combine multiple fields together, keeping in mind the help text that reads "Note that due to rendering order, you cannot use fields that come after this field; if you need a field not listed here, rearrange your fields."

In this case, make sure your image field appears above the body field, then edit the body field to enable rewriting and add the appropriate tokens, as listed under Replacement patterns.