Embedding YouTube Video as Item


I'm having trouble embedding a YouTube video as an item. I've tried to follow this recipe, putting the YouTube identifier in the Dublin Core field "Identifier" and the display in another field.


And I tried unchecking the html filter as per this post:

Any suggestions would be greatly appreciated!

My first guess is a mismatch between the functions used in the recipe, which is for Omeka 1.x, and the functions used for Omeka 2.x

Scanning through the changes in function here might help make the changes.

It's also possible that something has changed in the way that youtube builds their URLs, so comparing what's in the recipe to the embed codes that youtube currently gives might be needed.
Basically, item becomes metadata, and loop_items becomes loop

I was having the same problem, and in case y'all figured it out, I wanted to post my solution here for future reference. I tweaked the php a little bit, changing this:

<?php $youtube_id= item('Dublin Core', 'Identifier');?>

to this:

<?php $youtube_id= metadata('item', array('Dublin Core', 'Identifier')); ?>

And it made the YouTube video display on the item page. So patrickmj's suggestion worked, I just wanted to be explicit about the solution for the benefit of others.

Oops, I actually just added a YouTube video to EVERY item page. Ideas on how to fix this? Maybe using if and isset()?

That sounds like a good approach -- check whether there's a real youtube id with if. Not sure whether isset or empty will work better -- you could get an empty string back. But the general idea sounds right.

If there are other, non-youtube identifiers running around, it'll get more complicated, and you might have to check if an identifier looks like it's a youtube id with some kind of regex.