You could specify that the custom field is for the embed code and just use it directly in your template. You could also create two custom fields, one for the URL and one for the embed code and then conditionally show each/both based on whether they had values.
Another way to do it is to specify that your custom field is only for the code and then build the URL and/or embed code yourself. Let's say you named your custom field YOUTUBE_ID. The examples below show how you could build your template.
You would build the URL to look like this: http://www.youtube.com/watch?v=[YOUTUBE_ID]
You would build the embed code to look like this:
You can see a live example similar to this in the template I'm using for database of soccer fields on our staging Web site. This is using the Property Agent module, but the templating and custom field ideas are the same. Here's one field location, for example: Lake Sammamish State Park fields 3 - 10. The Current Weather section is built using the value of a custom field in which I store the ID for the Weather Underground Personal Weather Station closest to the field.
This method is a little harder for users, but it works quite well and gives you a lot of flexibility. |