I have an embedded Vimeo video on my homepage (In the index.php template file) and I am using their embed code which makes use of iframes. (I target the iframe in my video menu underneath, so that works well for what I’m doing.)
I’d like that video area, the iframe, to display one of three different videos (randomly chosen) when you load the page. When you refresh the page a different video, presumably, would load.
Does anyone have any suggestions? Am I barking up the wrong tree?
What you’re doing there is setting u the video URL’s, then generating a random number between 0 and 2 (in PHP all array indexs start at 0, not 1 so for an array with three items you choose between 0 and 2, not 1 and 3). From there you output the value at that index. That will give you a random video URL each time, and all you need to do to add in another video URL is to add a new line in the $url array.
Viewing 1 replies (of 1 total)
The topic ‘Change iframe src on refresh?’ is closed to new replies.