Since I’m not much of a php guy I need help with creating an array that holds YouTube videos and a description for each video.
Right now I have an array that only holds the video id’s. What is the best way to add a Description to each ID so I can easily loop through the array and create the desired output underneath.
<?php
$vids = array(
"OOWvNbU6ciLg",
"5itTJabAJfps",
"jFA8Tesmames",
"Trz9Y01xx1TY",
"mMQGcIrlyseU",
"qGrlQNvqqL14",
"QymnLbSpJ7lA",
"jFAh8Tesmmes",
"5itTJtbAJfps",
"OOWvNpU6ciLg"
);
?>
What I want eventually is a list of videos with a video description underneath. And I want my array to be shuffled before the list is created so I have a different order each time the list is created.
HTML
<li class="video">
<figure>
<iframe width="100%" height="200px" src="http://www.youtube.com/embed/OxXAT2epfEYA?HD=1;rel=0;showinfo=0" frameborder="0" allowfullscreen></iframe>
<figcaption>Description of the video</figcaption>
</figugre>
</li>
What would be the best way to define the array so I can shuffle it and then loop through the array and print each <li> item with the iframe embed code and the description underneath.
Thank you in advance.
Keep all info about video in associative array:
Now build an array of these videos:
Now you can shuffle it easily, and loop: