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 开发者_Go百科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:"alt";s:0:"";s:5:"title";s:0:"";}
[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.
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.
精彩评论