CCK question -- referencing an uploaded file in another Content Type

Events happening in the community are now at Drupal community events on www.drupal.org.
reedsparrow's picture

I need to set up a noderef to a file uploaded in a different content type. I have it working on some entries, but not on others and I cannot figure out the inconsistency.

Here's the puzzle: Content Type A needs to reference a file uploaded in Content Type B

  1. I created a noderef from Content Type A to Content Type B
  2. This created a link to Content Type B, but I really need to reference a file upload within Content Type B.
  3. I added the following snippet to the template for Content Type A to display the file upload field:

License/Offer Terms/Document Collection

<?php
foreach ((array)$node->field_pricing_terms as $item) {
?>

<?php
print $item['view']
?>

<?php
}
?>

With the current setup, I can create Content Type A and click the checkbox to reference the node for Content Type B, and my theory is that the php snippet in the template should go grab the filefield I need from Content Type B.

Two questions:
1 - -Why would this work on some nodes, but not others??
2 -- is there a better way to do this??

Thank you!

Comments

Can you give some more

rolodmonkey's picture

Can you give some more specific examples, maybe even the actual site to look at?

You say this words on some nodes, but not others. What is different about those nodes? Are the files the same type?

Learn more at iRolo.net.

Yale University

Group organizers

Group notifications

This group offers an RSS feed. Or subscribe to these personalized, sitewide feeds: