I am pulling in some youtube video thumbnails into my page with the following:
<img src="http://i3.ytimg.com/vi/<?php echo $youtubelist[$i];?>/default.jpg"></img>
(using a Joomla module to supply the youtube video ID’s at $youtubelist)
Along with the youtube thumbnail, I also want to pull in the youtube video ‘title’ & ‘description’.
How do I do this?
Thanks
[edited below]
This is my code & I want to place the title above the tag:
<?php
$youtubelist = explode( ',', $youtubecode );
$numyoutube = count($youtubelist);
//Get duplicate module or not
$a=1;
foreach ($list as $item) :
//$total=$a;
$enddbid = $item->id;
if ($ytslide==$enddbid) {$nummod=$a;}
$a++;
endforeach;
?>
<div id="videos">
<div style="padding-left: 2px; padding-right: 2px;padding-bottom:2px;">
<?php for ($i=0; $i<$numyoutube; $i++) { ?>
<a href="#">
<img src="http://i3.ytimg.com/vi/<?php echo $youtubelist[$i];?>/default.jpg"></img>
</a>
<?php } ?>
</div>
</div>
You can get information about a particular youtube video using this piece of code:
This will return Atom XML with the full metadata of the video, including title, author, dates, keywords, etc., etc. Read the
<title>element of the response to get what you need. So this code will give you what you’re after:With your code you’ll need to have something like this: