Log in

View Full Version : need help in videos in PHP



gurmeet
03-30-2009, 09:27 AM
hi friends...

i want to embedd the Youtube videos into my web page .. plz give me suggestions how i can embedd it with the help of PHP?
is there any specific classes or coding to add videos...? means any user of my site can upload its favourite videos into his/her web page...

Thanx in advanced for every suggestion

Nile
03-31-2009, 02:27 AM
Do you want a function like:


youtube("id");


Which would include the youtube video with the id id, or what?

Lpe04
03-31-2009, 03:04 AM
Create a function that takes the video ID and inserts it into the embed code.

Nile
03-31-2009, 03:28 AM
Here:


<?php
function include_youtube($id){
return '<object width="425" height="344"><param name="movie" value="http://www.youtube.com/v/'.$id.l=en&fs=1"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/'.$id.'&hl=en&fs=1" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="425" height="344"></embed></object>';


Usage:


echo include_youtube('id');