How can I cross-reference relevant content between 2 content types?
I am stuck at this point in trying to figure out how to display a block of relevant content for 2 different content types.
Here's the scenario: I am developing a site that offers food recipes and shopping tips to users. Each of those is a new content type I created with CCK.
The Recipe content type has many new fields I created, including Major Ingredient (meat, seafood, vegetarian, etc.), which is constrained to a select list, and Ingredients, which is a free text list (no taxonomy).
Shopping Tips uses free tagging for taxonomy, since I didn't think I could anticipate and list every possible ingredient in advance.
What I want to do is display a block of relevant shopping tips for every recipe node displayed (same ingredient), as well as a block of recipes that use the ingredient(s) listed in a shopping tip node.
I've looked at Relevant Content, but I don't think it will work for me since my list of ingredients in a recipe is not in any taxonomy.
I've also looked at the Similar Entries module, but apparently that won't work with custom content and field types. I also don't know if it will support two different block types, i.e., one block type to display recipes on shopping tips nodes and another to display shopping tips on recipe nodes.
Thank you all in advance for your help. This is my first Drupal project and I only started using it a few weeks ago.

Interested in this as
Interested in this as well.
It would be nice if Views could make blocks that would display relevant info (cross content types) based on a defined CCK field. So I could say, on Content Type "A" display list of nodes where CCK Field "1" is identical in Content Type "B".
Dan
_
Unless I'm misunderstanding, you should be able to do this with views using an argument and argument handling code.
_
Don't be a Help Vampire - read and abide the forum guidelines.
If you find my assistance useful, please pay it forward to your fellow drupalers.
It's possible this can be
It's possible this can be done, I'm not strong when it comes to Arguments.
If I have two content types, "A" and "B" and I have a CCK text field that appears in both, let's call it "Color". And I create a piece of content for each type, and in the "Color" field I put "Blue", how do I create a block that will display on type "A", and show fields from type "B", when the "Color" field of "B" matches that of "A"?
So the "blue" node of "A" would have a block of "B" nodes where the "Color" was also "blue"...
Make sense?
Thanks for any help.
Dan
_
Here you go:
$view = new view;$view->name = 'test_view';
$view->description = '';
$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' => 'Title',
'alter' => array(
'alter_text' => 0,
'text' => '',
'make_link' => 0,
'path' => '',
'link_class' => '',
'alt' => '',
'prefix' => '',
'suffix' => '',
'help' => '',
'trim' => 0,
'max_length' => '',
'word_boundary' => 1,
'ellipsis' => 1,
'strip_tags' => 0,
'html' => 0,
),
'link_to_node' => 0,
'exclude' => 0,
'id' => 'title',
'table' => 'node',
'field' => 'title',
'relationship' => 'none',
),
'type' => array(
'label' => 'Type',
'alter' => array(
'alter_text' => 0,
'text' => '',
'make_link' => 0,
'path' => '',
'link_class' => '',
'alt' => '',
'prefix' => '',
'suffix' => '',
'help' => '',
'trim' => 0,
'max_length' => '',
'word_boundary' => 1,
'ellipsis' => 1,
'strip_tags' => 0,
'html' => 0,
),
'link_to_node' => 0,
'exclude' => 0,
'id' => 'type',
'table' => 'node',
'field' => 'type',
'relationship' => 'none',
),
'field_color_value' => array(
'label' => 'Color',
'alter' => array(
'alter_text' => 0,
'text' => '',
'make_link' => 0,
'path' => '',
'link_class' => '',
'alt' => '',
'prefix' => '',
'suffix' => '',
'help' => '',
'trim' => 0,
'max_length' => '',
'word_boundary' => 1,
'ellipsis' => 1,
'strip_tags' => 0,
'html' => 0,
),
'link_to_node' => 0,
'label_type' => 'widget',
'format' => 'default',
'multiple' => array(
'group' => TRUE,
'multiple_number' => '',
'multiple_from' => '',
'multiple_reversed' => FALSE,
),
'exclude' => 0,
'id' => 'field_color_value',
'table' => 'node_data_field_color',
'field' => 'field_color_value',
'relationship' => 'none',
),
));
$handler->override_option('arguments', array(
'field_color_value' => 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',
'add_table' => 0,
'require_value' => 0,
'reduce_duplicates' => 0,
'id' => 'field_color_value',
'table' => 'node_data_field_color',
'field' => 'field_color_value',
'validate_user_argument_type' => 'uid',
'validate_user_roles' => array(
'2' => 0,
'4' => 0,
'3' => 0,
),
'relationship' => 'none',
'default_options_div_prefix' => '',
'default_argument_user' => 0,
'default_argument_fixed' => '',
'default_argument_php' => 'if (arg(0) == \'node\' && is_numeric(arg(1))) {
$node = node_load(arg(1));
if ($node->type == \'a\') {
return $node->field_color[0][value];
}
}
return FALSE;',
'validate_argument_node_type' => array(
'a' => 0,
'b' => 0,
'story' => 0,
),
'validate_argument_node_access' => 1,
'validate_argument_nid_type' => 'nid',
'validate_argument_vocabulary' => array(
'1' => 0,
'8' => 0,
'7' => 0,
'10' => 0,
'11' => 0,
'6' => 0,
'5' => 0,
'9' => 0,
'3' => 0,
'2' => 0,
'4' => 0,
),
'validate_argument_type' => 'tid',
'validate_argument_transform' => 0,
'validate_user_restrict_roles' => 0,
'validate_argument_is_member' => 0,
'validate_argument_php' => '',
),
));
$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(
'b' => 'b',
),
'group' => '0',
'exposed' => FALSE,
'expose' => array(
'operator' => FALSE,
'label' => '',
),
'id' => 'type',
'table' => 'node',
'field' => 'type',
'relationship' => 'none',
),
));
$handler->override_option('access', array(
'type' => 'none',
));
$handler->override_option('cache', array(
'type' => 'none',
));
$handler = $view->new_display('block', 'Block', 'block_1');
$handler->override_option('block_description', '');
$handler->override_option('block_caching', -1);
_
Don't be a Help Vampire - read and abide the forum guidelines.
If you find my assistance useful, please pay it forward to your fellow drupalers.
Wow, thanks for doing all
Wow, thanks for doing all that!
I've imported it and set the block, but nothing is displaying. When I pull up a node where this should appear, nothing at all displays (no block visible).
Dan
_
Do you have content types 'a' and 'b' and a text select list cck field named 'color' on your site or did you edit the view (including the argument code) to reflect the actual content types and field? I mostly meant this as a guide-- I didn't think it would work as a drop in view unless you match the specifications exactly.
_
Don't be a Help Vampire - read and abide the forum guidelines.
If you find my assistance useful, please pay it forward to your fellow drupalers.
I changed the code to reflect
I changed the code to reflect the actual field name (not color), but not the content type...now it works!
Is there some sort of Drupal.org award I can nominate you for? Your always very helpful!
Dan
(you can ignore my other post trying to clarify)
_
Thanks for the kind words... just pay it forward when you can is all I ask. ;-)
_
Don't be a Help Vampire - read and abide the forum guidelines.
If you find my assistance useful, please pay it forward to your fellow drupalers.
Maybe I haven't explained it
Maybe I haven't explained it well.
Types A and B have multiple CCK fields which are unique to them, but share "Color" (this is just an example).
When someone is viewing a node of type A, I want a block to display which shows fields of a node of type B when a B type node has the same Color as the A type being viewed. There may be more than one node of type B which has the same Color as the A one being viewed, so it would list them all...
Did that make it worse?