创建“文件”视图,然后在视图 UI 右侧的高级折叠字段集下,创建节点与文件的关系(连接)。
这是一个快速视图,您可以在此处复制并导入您的视图 ui:
<?php
$view = new view;
$view->name = 'test';
$view->description = '';
$view->tag = 'default';
$view->base_table = 'file_managed';
$view->human_name = 'test';
$view->core = 7;
$view->api_version = '3.0';
$view->disabled = FALSE; /* Edit this to true to make a default view disabled initially */
/* Display: Master */
$handler = $view->new_display('default', 'Master', 'default');
$handler->display->display_options['title'] = 'test';
$handler->display->display_options['access']['type'] = 'perm';
$handler->display->display_options['cache']['type'] = 'none';
$handler->display->display_options['query']['type'] = 'views_query';
$handler->display->display_options['query']['options']['query_comment'] = FALSE;
$handler->display->display_options['exposed_form']['type'] = 'basic';
$handler->display->display_options['pager']['type'] = 'full';
$handler->display->display_options['pager']['options']['items_per_page'] = '10';
$handler->display->display_options['style_plugin'] = 'default';
$handler->display->display_options['row_plugin'] = 'fields';
/* Relationship: File Usage: Content */
$handler->display->display_options['relationships']['file_to_node']['id'] = 'file_to_node';
$handler->display->display_options['relationships']['file_to_node']['table'] = 'file_usage';
$handler->display->display_options['relationships']['file_to_node']['field'] = 'file_to_node';
$handler->display->display_options['relationships']['file_to_node']['required'] = 0;
/* Field: File: Name */
$handler->display->display_options['fields']['filename']['id'] = 'filename';
$handler->display->display_options['fields']['filename']['table'] = 'file_managed';
$handler->display->display_options['fields']['filename']['field'] = 'filename';
$handler->display->display_options['fields']['filename']['label'] = '';
$handler->display->display_options['fields']['filename']['alter']['alter_text'] = 0;
$handler->display->display_options['fields']['filename']['alter']['make_link'] = 0;
$handler->display->display_options['fields']['filename']['alter']['absolute'] = 0;
$handler->display->display_options['fields']['filename']['alter']['word_boundary'] = 0;
$handler->display->display_options['fields']['filename']['alter']['ellipsis'] = 0;
$handler->display->display_options['fields']['filename']['alter']['strip_tags'] = 0;
$handler->display->display_options['fields']['filename']['alter']['trim'] = 0;
$handler->display->display_options['fields']['filename']['alter']['html'] = 0;
$handler->display->display_options['fields']['filename']['hide_empty'] = 0;
$handler->display->display_options['fields']['filename']['empty_zero'] = 0;
$handler->display->display_options['fields']['filename']['link_to_file'] = 1;
/* Field: Content: Body */
$handler->display->display_options['fields']['body']['id'] = 'body';
$handler->display->display_options['fields']['body']['table'] = 'field_data_body';
$handler->display->display_options['fields']['body']['field'] = 'body';
$handler->display->display_options['fields']['body']['relationship'] = 'file_to_node';
/* Field: Content: Date */
$handler->display->display_options['fields']['field_date']['id'] = 'field_date';
$handler->display->display_options['fields']['field_date']['table'] = 'field_data_field_date';
$handler->display->display_options['fields']['field_date']['field'] = 'field_date';
$handler->display->display_options['fields']['field_date']['relationship'] = 'file_to_node';
$handler->display->display_options['fields']['field_date']['alter']['alter_text'] = 0;
$handler->display->display_options['fields']['field_date']['alter']['make_link'] = 0;
$handler->display->display_options['fields']['field_date']['alter']['absolute'] = 0;
$handler->display->display_options['fields']['field_date']['alter']['external'] = 0;
$handler->display->display_options['fields']['field_date']['alter']['replace_spaces'] = 0;
$handler->display->display_options['fields']['field_date']['alter']['trim_whitespace'] = 0;
$handler->display->display_options['fields']['field_date']['alter']['nl2br'] = 0;
$handler->display->display_options['fields']['field_date']['alter']['word_boundary'] = 1;
$handler->display->display_options['fields']['field_date']['alter']['ellipsis'] = 1;
$handler->display->display_options['fields']['field_date']['alter']['strip_tags'] = 0;
$handler->display->display_options['fields']['field_date']['alter']['trim'] = 0;
$handler->display->display_options['fields']['field_date']['alter']['html'] = 0;
$handler->display->display_options['fields']['field_date']['element_label_colon'] = 1;
$handler->display->display_options['fields']['field_date']['element_default_classes'] = 1;
$handler->display->display_options['fields']['field_date']['hide_empty'] = 0;
$handler->display->display_options['fields']['field_date']['empty_zero'] = 0;
$handler->display->display_options['fields']['field_date']['hide_alter_empty'] = 1;
$handler->display->display_options['fields']['field_date']['settings'] = array(
'format_type' => 'long',
'fromto' => 'both',
'multiple_number' => '',
'multiple_from' => '',
'multiple_to' => '',
'show_repeat_rule' => 'show',
);
$handler->display->display_options['fields']['field_date']['group_rows'] = 1;
$handler->display->display_options['fields']['field_date']['delta_offset'] = '0';
$handler->display->display_options['fields']['field_date']['delta_reversed'] = 0;
$handler->display->display_options['fields']['field_date']['delta_first_last'] = 0;
$handler->display->display_options['fields']['field_date']['field_api_classes'] = 0;
/* Field: Content: Link */
$handler->display->display_options['fields']['view_node']['id'] = 'view_node';
$handler->display->display_options['fields']['view_node']['table'] = 'views_entity_node';
$handler->display->display_options['fields']['view_node']['field'] = 'view_node';
/* Field: Content: Title */
$handler->display->display_options['fields']['title']['id'] = 'title';
$handler->display->display_options['fields']['title']['table'] = 'node';
$handler->display->display_options['fields']['title']['field'] = 'title';
/* Sort criterion: File: Upload date */
$handler->display->display_options['sorts']['timestamp']['id'] = 'timestamp';
$handler->display->display_options['sorts']['timestamp']['table'] = 'file_managed';
$handler->display->display_options['sorts']['timestamp']['field'] = 'timestamp';
$handler->display->display_options['sorts']['timestamp']['order'] = 'DESC';
/* Display: Page */
$handler = $view->new_display('page', 'Page', 'page');
$handler->display->display_options['path'] = 'test';
?>
至于围绕整个 RSS 打印输出的正确标记,您可以操作视图模板。要修改每条记录,请使用 views-view-fields--test.tpl.php(例如)。对于整个视图的包装器,请使用 views-view--test.tpl.php (例如)。可用的模板位于视图 UI 上第三个栏杆(折叠的栏杆)底部的“主题”链接下。只需将视图模板文件放入您的主题文件夹并全部抄送。
乔