Hoping someone can point me in the right direction here.
I am using Node Relativity, and I have added a video to the parent node and want it to appear on all child nodes as well.
I've tried doing this with a node_load->nid, but I cant figure out how to get the [view] for the field. I'm thinking I have to run this through a theme function?
$nid = $parent_node;
$parent = node_load($nid);
if ($parent->field_video[0]) {
do something here...
}
Just for a test I ran it through theme_video_cck_video_embed using the code suggested in the video_cck.module and that works perfectly, printing everything in a nice form text area.
I take it need to use theme('video_cck_video_video', $field, $item, $formatter, $node); but I cant figure out how that is working.
Any pointers much appreciated.
Comments
Comment #1
alex ua commentedThe print command you're looking for should be something like:
print $parent->field_video[0]['view']Does that not work?
Comment #2
Jeff Burnz commentedUnfortunately it does not - when you do the node_load, [view] is not available.
Comment #3
aaron commentedcorrect. you would need to use node_view($parent) after loading it before you have access to the ->field_video array
Comment #4
Jeff Burnz commentedHey, thanks so much for that aaron, works a charm, I had been tinkering with the node_view but no joy until now, thanks again, much appreciated both of you...
Heres the solution to print emfield video_cck video parent video in the child nodes (I use this in my child node node-xxx.tpl.php file)
Comment #5
aaron commentedthat will work fine, but a more technically "correct" solution would be something like the following:
there might be some circumstances that $parent->field_video[0]['view'] would not be empty, even if there were no video. although that would only be if you were overriding the theme or using a custom provider, so what you have would work for nearly every circumstance. for instance, someone might want to override the theme to have a thumbnail saying 'no video available' when the value is empty, but not want that on teasers. this solution would be better for that type of implementation.
aaron
Comment #6
aaron commentedalso, be careful with node_loads. in most circumstances, there's almost always a way to do what you want with a list view, which will only load the necessary fields. node_load with node_view is query intensive, which can cause performance issues for high load sites.
Comment #7
Jeff Burnz commentedYes, thats a good point you make there, since I did not need to worry about it I used 'view', but for others it may be important, thanks for pointing that out.
Comment #8
Anonymous (not verified) commentedAutomatically closed -- issue fixed for two weeks with no activity.