I am working on a website for a client who has an extensive video library hosted on various video services, youTube, BlibTV etc. These videos are inserted inline via embed code in various pages articles and stories. The problem arises when one wants to update a video that is used in multiple locations - one has to update every embedded video instance. I also have a record with the embed code as a content item on the site. If I where able to reference this code instead of inserting the embed code directly then I could change the content item and all video instances would be updated automatically.
My first thought was to embed a cck field in the node body. Does anybody have an idea how I could accomplish this? Any pointers would be appreciated.
Comments
If you have not already tried
If you have not already tried it, you might want to install the Embedded Media Field Module: http://drupal.org/project/emfield
I believe that it does what you are looking to do.
-- Julia v.
http://www.pfvdw.com
Thanks for the fast reply
Thanks for the fast reply Julia,
I am using emfield in a content type to store the embedded code for video resources. But that is only good for constructing a page with cck fields.
I like to insert such a field into the body text of a node, just like inserting an image. That allows admins to insert a video easily into a node. If this would be a cck field then updating this video would just require an update in the content item and not in the page itself.
Ok, so if I understand you
Ok, so if I understand you correctly, you have nodes with embedded video fields in them, and you would like the videos to appear inline with text?
If that is the case, you might achieve this just with CSS, or create a custom node template for that content type and nest the fields as desired.
-- Julia v.
http://www.pfvdw.com
A way to do this
(apologies, this should have been in reply to the main node, not a comment)
If I understand you correctly, you want to have a given video entity which you insert into the bodies of other nodes, but be able to update that video entity and have the changes appear in all these other nodes.
You could use Insert Node:
http://drupal.org/project/insertnode
Then you would have a video content type; this would essentially be a node with only an emfield, to contain the video. And then, you would use Insert Node to place a reference to that video node in the content body of another node.
You would have to do some reading in the Insert Node documentation to make sure that you're only getting what you want out of the video nodes (i.e. only the video content and nothing else) but I think it's able to do this out of the box, more or less.
Another way to do this would again to have video content type nodes, and to have a nodereference field in your other nodes which hosts the video in their content body. Then you could either a) write an input filter to do the substitution, or b) write a preprocess function to do the substitution. This of course depends on how comfortable you are writing PHP, etc.
Good luck!
-Tim Cosgrove
http://www.treehouseagency.com/
Further clarification
The advantage to doing it the second way (with nodereferences) is that you could establish a connection between nodes; i.e you'd have on record and be able to leverage the information that blog post X has video node Y embedded in it. You'd also be able to leverage some of the niceties of the nodereference CCK field, such as autocomplete and restricting the field to certain kinds of nodes, etc.
If you do it with Insert Node alone, I believe you would have to manually look up the nid of the video node you want to embed.
Tim + Julia, Thank you for
Tim + Julia,
Thank you for taking the time to answer. What Tim outlined is exactly what I am looking for. It says:"...insert a node in any text area that supports filters" and that is what I need to do. I'll digest the documentation and if this solves my problem I'll follow up with a solution post.
Werner
Just a cuious thought Could
Just a cuious thought
Could one use nodereference to establish the relationship and insertnode as the way to pull in video from nodereference
benifits of nodereference with the filter support (no php coding/hooks) of insertnode
How would you do that
How would you do that practically? I don't know. It seems simple with using nodeinsert. If I read the docs right all I have to do is insert, for example [node:article41 cck=field_video; plain] into the node body. This will insert the content of cck field video into the node without any enclosing tag. So if the cck field vide contains the video embed code this should do it. Need to check this out tomorrow. Will report back then
I can report success. The
I can report success. The node insert module works great. So let me recap what I did for anyone who will have the same challenge.
Background: We have many video assets that are stored on various internet video platforms, etc. YouTube, BlibTV, etc.
Requirement: Any of these videos might be used on a content page of a website. A video can be used on multiple pages. We need the ability to update a video source centrally so all video instances are updated when the video changes.
Solution: Use the insert node module (http://drupal.org/project/insertnode). This module is an input filter that allows us to add a node or just a node field into another node. In my case I created video nodes that hold all info about the video. One field in the video content type is an emfield (http://drupal.org/project/emfield) in my case called video_index. This field holds either a link to or the embed code for the video. Now I insert the following into my new node body: [node:123 cck=field_video_index; plain] and that is all. Very simple once one knows where to look. Thanks again to tim.cosgrove for the pointer.