Drupal Questions & Answers

Ask and answer Drupal related questions! No question too simple or complex!
aeth's picture
Asked by on Mon 3rd Jan 2011
I need to display a block view only in specific nodes.

I have a content type called “performances” that I want to display in a block view on another content page type called “sheets”.

The problem is I only want to display the performances that have the same title as the sheets title page. I made a drop down box where users have to choose a referenced sheet title so every performance has a referenced sheet title already.

I am just not sure how to set the argument to display all users who have created a performance for the referenced sheet in a block on the sheet page they are viewing.

The closest thing I have found was this code on the site from another post (I use pathauto for alias):

$path = drupal_get_path_alias($_GET[‘q’]);
$path = explode(’/’, $path);

if ($path0 == ‘sheet’ && $path1 != ‘’) {
return $path;
}

But I probably didn’t modify it correctly..

Any help is appreciated!

(here is my views code if it helps)

$view = new view; $view->name = ‘sheet_performances’; $view->description = ‘performances sheets’; $view->tag = ‘performances sheets’; $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(‘relationships’, array( ‘field_sheet_performance_nid’ => array( ‘label’ => ‘performance’, ‘required’ => 0, ‘delta’ => 1, ‘id’ => ‘field_sheet_performance_nid’, ‘table’ => ‘node_data_field_sheet_performance’, ‘field’ => ‘field_sheet_performance_nid’, ‘relationship’ => ‘none’, ), )); $handler>override_option(‘fields’, array( ‘name_1’ => array( ‘label’ => ‘Performer’, ‘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_user’ => 1, ‘overwrite_anonymous’ => 0, ‘anonymous_text’ => ‘’, ‘exclude’ => 0, ‘id’ => ‘name_1’, ‘table’ => ‘users’, ‘field’ => ‘name’, ‘relationship’ => ‘none’, ), ‘title’ => array( ‘label’ => ‘Title’, ‘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’ => 1, ‘exclude’ => 1, ‘id’ => ‘title’, ‘table’ => ‘node’, ‘field’ => ‘title’, ‘override’ => array( ‘button’ => ‘Override’, ), ‘relationship’ => ‘field_sheet_performance_nid’, ), ‘created’ => array( ‘label’ => ‘Added’, ‘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, ‘date_format’ => ‘custom’, ‘custom_date_format’ => ‘M j, Y’, ‘exclude’ => 0, ‘id’ => ‘created’, ‘table’ => ‘node’, ‘field’ => ‘created’, ‘relationship’ => ‘none’, ‘override’ => array( ‘button’ => ‘Override’, ), ), )); $handler->override_option(‘arguments’, array( ‘title’ => array( ‘default_action’ => ‘default’, ‘style_plugin’ => ‘default_summary’, ‘style_options’ => array(), ‘wildcard’ => ‘all’, ‘wildcard_substitution’ => ‘All’, ‘title’ => ‘1’, ‘breadcrumb’ => ‘’, ‘default_argument_type’ => ‘php’, ‘default_argument’ => ‘’, ‘validate_type’ => ‘none’, ‘validate_fail’ => ‘not found’, ‘glossary’ => 0, ‘limit’ => ‘0’, ‘case’ => ‘none’, ‘path_case’ => ‘none’, ‘transform_dash’ => 0, ‘id’ => ‘title’, ‘table’ => ‘node’, ‘field’ => ‘title’, ‘validate_user_argument_type’ => ‘uid’, ‘validate_user_roles’ => array( ‘2’ => 0, ‘10’ => 0, ‘9’ => 0, ‘11’ => 0, ‘8’ => 0, ‘6’ => 0, ‘7’ => 0, ), ‘relationship’ => ‘field_sheet_performance_nid’, ‘default_options_div_prefix’ => ‘’, ‘default_argument_fixed’ => ‘’, ‘default_argument_user’ => 0, ‘default_argument_php’ => ‘$path = drupal_get_path_alias($_GET[\‘q\’]); $path = explode(\’/\’, $path); if ($path0 == \‘sheet\’ && $path1 != \’\’) { return $path; }’, ‘validate_argument_node_type’ => array( ‘forum’ => 0, ‘panel’ => 0, ‘page’ => 0, ‘performances’ => 0, ‘sheet’ => 0, ‘story’ => 0, ‘uprofile’ => 0, ‘userrequests’ => 0, ‘vidtutorial’ => 0, ), ‘validate_argument_node_access’ => 0, ‘validate_argument_nid_type’ => ‘nid’, ‘validate_argument_vocabulary’ => array( ‘4’ => 0, ‘2’ => 0, ‘6’ => 0, ‘1’ => 0, ‘8’ => 0, ‘3’ => 0, ‘7’ => 0, ), ‘validate_argument_type’ => ‘tid’, ‘validate_argument_transform’ => 0, ‘validate_user_restrict_roles’ => 0, ‘validate_argument_node_flag_name’ => ‘relationship‘, ‘validate_argument_node_flag_test’ => ‘flaggable’, ‘validate_argument_node_flag_id_type’ => ‘id’, ‘validate_argument_user_flag_name’ => ‘relationship‘, ‘validate_argument_user_flag_test’ => ‘flaggable’, ‘validate_argument_user_flag_id_type’ => ‘id’, ‘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’, ‘override’ => array( ‘button’ => ‘Override’, ), ‘relationship’ => ‘none’, ), ‘type’ => array( ‘operator’ => ‘in’, ‘value’ => array( ‘performances’ => ‘performances’, ), ‘group’ => ‘0’, ‘exposed’ => FALSE, ‘expose’ => array( ‘operator’ => FALSE, ‘label’ => ‘’, ), ‘id’ => ‘type’, ‘table’ => ‘node’, ‘field’ => ‘type’, ‘relationship’ => ‘none’, ‘override’ => array( ‘button’ => ‘Override’, ), ), )); $handler->override_option(‘access’, array( ‘type’ => ‘none’, )); $handler->override_option(‘cache’, array( ‘type’ => ‘none’, )); $handler->override_option(‘items_per_page’, 25); $handler->override_option(‘use_pager’, ‘0’); $handler->override_option(‘use_more’, 0); $handler->override_option(‘use_more_always’, 0); $handler->override_option(‘style_plugin’, ‘table’); $handler->override_option(‘style_options’, array( ‘grouping’ => ‘’, ‘override’ => 1, ‘sticky’ => 1, ‘order’ => ‘asc’, ‘columns’ => array( ‘name_1’ => ‘name_1’, ‘title’ => ‘title’, ‘created’ => ‘created’, ), ‘info’ => array( ‘name_1’ => array( ‘sortable’ => 1, ‘separator’ => ‘’, ), ‘title’ => array( ‘sortable’ => 1, ‘separator’ => ‘’, ), ‘created’ => array( ‘sortable’ => 1, ‘separator’ => ‘’, ), ), ‘default’ => ‘title’, )); $handler->override_option(‘row_options’, array( ‘inline’ => array(), ‘separator’ => ‘’, ‘hide_empty’ => 0, )); $handler = $view->new_display(‘block’, ‘Block’, ‘block_1’); $handler->override_option(‘block_description’, ‘’); $handler->override_option(‘block_caching’, 1); $handler = $view>new_display(‘page’, ‘Page’, ‘page_1’); $handler->override_option(‘path’, ‘performance/‘); $handler->override_option(‘menu’, array( ‘type’ => ‘none’, ‘title’ => ‘’, ‘description’ => ‘’, ‘weight’ => 0, ‘name’ => ‘navigation’, )); $handler->override_option(‘tab_options’, array( ‘type’ => ‘none’, ‘title’ => ‘’, ‘description’ => ‘’, ‘weight’ => 0, ‘name’ => ‘navigation’, ));

Commenting on this Drupal Question is closed.