2011-09-23 76 views
1

我有一个视图设置为显示精选文章节点。每个节点有2个分类词汇可供使用。第一个是'特色',术语'是';第二个是'Section',条款:Home,Info,Blog等。如果节点有术语Yes(精选词汇)和术语Blog(Section vocab),那么如果你要浏览到domain.com/blog,那么你会看到特色内容。Drupal Views-按多个分类术语筛选

该视图设置为接受url中的第一个参数,以确定您正在查看的网站的哪一部分(视图参数:分类术语)。这按预期工作。

最后,我按节点类型(Article)和分类词汇表(精选)过滤,这是我的视图无法返回内容的地方。如果我删除分类词汇过滤器,它将显示每个部分的正确显示,尽管它显示所有文章节点。

难道问题是参数和过滤器是不同的分类词汇吗?

这里的SQL查询:

SELECT node.nid AS nid, 
    node.type AS node_type, 
    node.vid AS node_vid, 
    node_data_field_article_images.field_article_images_data AS node_data_field_article_images_field_article_images_data, 
    node.title AS node_title, 
    node.created AS node_created 
    FROM node node 
    LEFT JOIN content_field_article_images node_data_field_article_images ON node.vid = node_data_field_article_images.vid 
    LEFT JOIN term_node term_node ON node.vid = term_node.vid 
    LEFT JOIN term_data term_data ON term_node.tid = term_data.tid 
    WHERE (node.status <> 0) AND (node.type in ('article')) AND (node_data_field_article_images.field_article_images_list <> 0) AND (term_data.vid in ('20')) AND (term_data.name = 'home') 
    ORDER BY node_created DESC 

这是我的观点:

$view = new view; 
    $view->name = 'marquee_slideshow_dev'; 
    $view->description = 'Marquee on homepage and landing pages'; 
    $view->tag = ''; 
    $view->view_php = ''; 
    $view->base_table = 'node'; 
    $view->is_cacheable = FALSE; 
    $view->api_version = 2; 
    $view->disabled = FALSE; /* Edit this to true to make a default view disabled initially */ 
    $handler = $view->new_display('default', 'Defaults', 'default'); 
    $handler->override_option('fields', array(
    'title' => array(
     'label' => '', 
     'alter' => array(
     'alter_text' => 0, 
     'text' => '', 
     'make_link' => 0, 
     'path' => '', 
     'link_class' => '', 
     'alt' => '', 
     'prefix' => '', 
     'suffix' => '', 
     'target' => '', 
     'help' => '', 
     'trim' => 0, 
     'max_length' => '', 
     'word_boundary' => 1, 
     'ellipsis' => 1, 
     'html' => 0, 
     'strip_tags' => 0, 
    ), 
     'empty' => '', 
     'hide_empty' => 0, 
     'empty_zero' => 0, 
     'link_to_node' => 0, 
     'exclude' => 0, 
     'id' => 'title', 
     'table' => 'node', 
     'field' => 'title', 
     'relationship' => 'none', 
     'override' => array(
     'button' => 'Override', 
    ), 
    ), 
)); 
    $handler->override_option('sorts', array(
    'created' => array(
     'order' => 'DESC', 
     'granularity' => 'second', 
     'id' => 'created', 
     'table' => 'node', 
     'field' => 'created', 
     'relationship' => 'none', 
    ), 
)); 
    $handler->override_option('arguments', array(
    'name' => array(
     'default_action' => 'default', 
     'style_plugin' => 'default_summary', 
     'style_options' => array(), 
     'wildcard' => 'all', 
     'wildcard_substitution' => 'All', 
     'title' => '', 
     'breadcrumb' => '', 
     'default_argument_type' => 'php', 
     'default_argument' => '', 
     'validate_type' => 'none', 
     'validate_fail' => 'not found', 
     'glossary' => 0, 
     'limit' => '0', 
     'case' => 'lower', 
     'path_case' => 'lower', 
     'transform_dash' => 1, 
     'add_table' => 0, 
     'require_value' => 0, 
     'id' => 'name', 
     'table' => 'term_data', 
     'field' => 'name', 
     'validate_user_argument_type' => 'uid', 
     'validate_user_roles' => array(
     '2' => 0, 
     '7' => 0, 
     '8' => 0, 
     '4' => 0, 
     '6' => 0, 
     '5' => 0, 
    ), 
     'relationship' => 'none', 
     'default_options_div_prefix' => '', 
     'default_argument_fixed' => '', 
     'default_argument_user' => 0, 
     'default_argument_image_size' => '_original', 
     'default_argument_php' => '$path = explode(\'/\', drupal_get_path_alias($_GET[\'q\'])); 
    $is_front = $_GET[\'q\'] == \'<front>\' || $_GET[\'q\'] == variable_get(\'site_frontpage\', \'<front>\'); 
    $arg0 = arg(0); 

    if ($is_front) { 
    return \'home\'; 
    } else if ($arg0 = \'node\' && arg(1) != \'add\' && arg(2) != \'edit\' && arg(2) != \'delete\' && $path[0] != \'\') { 
    return $path[0]; 
    } 
    ', 
     'validate_argument_node_type' => array(
     'activitystream' => 0, 
     'image' => 0, 
     'contenttab' => 0, 
     'content_about_fedex_content_page' => 0, 
     'content_about_fedex_home_page' => 0, 
     'content_about_fedex_landing_page' => 0, 
     'content_access_article' => 0, 
     'content_access_article_index' => 0, 
     'content_access_content_page' => 0, 
     'content_access_landing_page' => 0, 
     'content_block' => 0, 
     'content_case_study' => 0, 
     'content_document' => 0, 
     'content_event' => 0, 
     'content_executive_viewpoint' => 0, 
     'content_feature' => 0, 
     'content_fedex_fact' => 0, 
     'content_fedex_video_page' => 0, 
     'content_great_place_to_work' => 0, 
     'content_location' => 0, 
     'content_opco_overview' => 0, 
     'content_our_commitment_content_p' => 0, 
     'content_our_commitment_landing_p' => 0, 
     'content_region_overview' => 0, 
     'content_resources' => 0, 
     'content_sag' => 0, 
     'content_small_business' => 0, 
     'page' => 0, 
     'slideshow_image' => 0, 
     'story' => 0, 
    ), 
     'validate_argument_node_access' => 0, 
     'validate_argument_nid_type' => 'nid', 
     'validate_argument_vocabulary' => array(
     '14' => 0, 
     '18' => 0, 
     '17' => 0, 
     '11' => 0, 
     '10' => 0, 
     '15' => 0, 
     '9' => 0, 
     '3' => 0, 
     '16' => 0, 
     '8' => 0, 
     '5' => 0, 
     '2' => 0, 
     '7' => 0, 
     '19' => 0, 
     '1' => 0, 
     '12' => 0, 
     '13' => 0, 
    ), 
     'validate_argument_type' => 'tid', 
     'validate_argument_transform' => 0, 
     'validate_user_restrict_roles' => 0, 
     'image_size' => array(
     '_original' => '_original', 
     'thumbnail' => 'thumbnail', 
     'preview' => 'preview', 
     'icon' => 'icon', 
    ), 
     'validate_argument_php' => '', 
     'override' => array(
     'button' => 'Override', 
    ), 
    ), 
)); 
    $handler->override_option('filters', array(
    'status' => array(
     'operator' => '=', 
     'value' => '1', 
     'group' => '0', 
     'exposed' => FALSE, 
     'expose' => array(
     'operator' => FALSE, 
     'label' => '', 
    ), 
     'id' => 'status', 
     'table' => 'node', 
     'field' => 'status', 
     'relationship' => 'none', 
    ), 
    'type' => array(
     'operator' => 'in', 
     'value' => array(
     'article' => 'article', 
    ), 
     'group' => '0', 
     'exposed' => FALSE, 
     'expose' => array(
     'operator' => FALSE, 
     'label' => '', 
    ), 
     'id' => 'type', 
     'table' => 'node', 
     'field' => 'type', 
     'relationship' => 'none', 
    ), 
    'vid' => array(
     'operator' => 'in', 
     'value' => array(
     '20' => '20', 
    ), 
     'group' => '0', 
     'exposed' => FALSE, 
     'expose' => array(
     'operator' => FALSE, 
     'label' => '', 
    ), 
     'id' => 'vid', 
     'table' => 'term_data', 
     'field' => 'vid', 
     'relationship' => 'none', 
    ), 
)); 
    $handler->override_option('access', array(
    'type' => 'none', 
)); 
    $handler->override_option('cache', array(
    'type' => 'none', 
)); 
    $handler->override_option('empty_format', '3'); 
    $handler->override_option('items_per_page', 0); 
    $handler->override_option('use_pager', 'mini'); 
    $handler->override_option('distinct', 0); 
    $handler->override_option('style_options', array(
    'grouping' => '', 
)); 
    $handler = $view->new_display('block', 'Home Page', 'block_1'); 
    $handler->override_option('block_description', ''); 
    $handler->override_option('block_caching', -1); 

回答

0

希望你有其中有来自两个词汇.. 方面的一个节点其很难从出口视图解决这个问题.. 你可以做的是提供sql查询哪些视图正在生成检查它或张贴在这里..

+0

添加查询到我原来的职位。干杯 – atb

+0

是的,我有3个文章节点的术语“家”,其中2个也是术语'是' – atb

+0

任何想法?干杯 – atb

相关问题