开发者

Bring field content from "parent" node to "child" node in Drupal

开发者 https://www.devze.com 2023-01-15 23:09 出处:网络
What I need to do is bring data from a field in a \"parent\" node to a \"child\" node. Something like the following:

What I need to do is bring data from a field in a "parent" node to a "child" node. Something like the following:

$myactive_trail = menu_get_active_trail();
$parent = $myactive_trail['2']['link_path'];
print $parent->field_video['0']['filepath'];

I know that there is not su开发者_开发技巧ch thing as a parent not hence me trying to use menu_get_active_trail(). I can print the $parent link_path, but don't know how to call up a field from the parent node.


I was in a similar position. CCK Node references are quite useful, and actually rather simple once you know how to manipulate them. If I understand your question correctly... I believe you want to add parts of the "parent" node type when you display the "child" node type. If that's right, there is a tutorial video that explains how to do EXACTLY that. It also gives pointers on actually setting up a CCK node reference.

http://geoffhankerson.com/drupal/cck-nodereference-screencast.html

Hope this helps!

0

精彩评论

暂无评论...
验证码 换一张
取 消