I have a cck content type with an embedded video field and a custom template. When I try to do something like this:

print_r(node_load($nid));

I find the following snippet in the output.

[field_video_media] => Array
        (
            [0] => Array
                (
                    [embed] => http://historicalthinkingmatters.org/media/JoyAFT384K_Stream.mov
                    [value] => http://historicalthinkingmatters.org/media/JoyAFT384K_Stream.mov
                    [provider] => zzz_custom_url
                    [data] => Array
                        (
                            [type] => mov
                        )
                )
        )

The problem is, field_video_media[0]['view'] isn't being set, so it's not available in my template when I pass the loaded node through theme(). If I don't use node_load(), and instead view a single node (e.g. example.com/node/555) then field_video_media[0]['view'] is set somewhere along the way as you can see in the output of this snippet:

function _phptemplate_variables($hook, $vars) {
	if ($hook == 'node'){print_r($vars);}
}
snippet from output...

    [field_video_media] => Array
        (
            [0] => Array
                (
                    [embed] => http://historicalthinkingmatters.org/media/JoyAFT384K_Stream.mov
                    [value] => http://historicalthinkingmatters.org/media/JoyAFT384K_Stream.mov
                    [provider] => zzz_custom_url
                    [data] => Array
                        (
                            [type] => mov
                        )
                    [view] => <embed src="http://historicalthinkingmatters.org/media/JoyAFT384K_Stream.mov" width="240" height="135" autoplay="false" controller="true" type="video/quicktime" scale="tofit" pluginspage="http://www.apple.com/quicktime/download/"> </embed>
                )
        )

Any ideas why node_load isn't doing what I expect?

I'm using Drupal 5.7. Let me know if there's any more information I can provide and thanks in advance.

-Jon

Comments

jonlesser’s picture

Status: Active » Closed (fixed)

I solved my own issue. The problem was that I was using node_load and passing the output to the theme function. I should have been using node_view so all of the alter hooks and input filters would fire.
$nodes .= node_view(node_load($item->nid),$teaser);