Jump to content

Attention PHP Coding Gurus


saint
 Share

Recommended Posts

If you are familiar with PHP, I desperately need your HELP :)

( I am willing to pay a reasonable fee for this coding assistance. )

 

I have a lot of Youtube videos that I want to embed on a website, but want to stay away from creating individual pages for each individual video.

 

 

I want to create a "generic" page that could display any of the videos.

 

A PHP script would load the generic video page and send specific information to a embedded youtube player located on that page.

 

This PHP script would be activated by clicking on a html link.

 

Example:

 

"http://www.mydomain.com/music.php?song_title,youtube_id"

 

Each link would have a different song title / youtube id number - to correspond to the specific youtube video.

 

The song title would be displayed above the youtube embedded youtube player and the youtube id number would be placed in the embedded player to allow video playback.

 

Thanks every one !

Link to comment
Share on other sites

Sorry it took so long to reply. Really had to go digging into my archives as this technique I used to use ad-nauseum on every site I developed.

 

The basis of it is actually pretty easy once you figure it out. Here's a small snippet example to go on:

[/font][/color][color=#000088][font=Consolas]if[/font][/color][color=#666600][font=Consolas](![/font][/color][color=#000000][font=Consolas]isset[/font][/color][color=#666600][font=Consolas]([/font][/color][color=#000000][font=Consolas]$_GET[/font][/color][color=#666600][font=Consolas][[/font][/color][color=#008800][font=Consolas]'ytid'[/font][/color][color=#666600][font=Consolas]])[/font][/color][color=#666600][font=Consolas]{
[/font][/color][font=Consolas][color=#000000]echo "No Video here!"; // Insert default content for no video id being specified here[/color][color=#880000]
[/color][/font][color=#666600][font=Consolas]}[/font][/color][color=#000088][font=Consolas]else[/font][/color][color=#666600][font=Consolas]{
[/font][/color][color=#000000][font=Consolas]$ytid [/font][/color][color=#666600][font=Consolas]=[/font][/color][color=#000000][font=Consolas] $_GET[/font][/color][color=#666600][font=Consolas][[/font][/color][color=#008800][font=Consolas]'ytid'[/font][/color][color=#666600][font=Consolas]];
?>

[/font][/color][color=#666600][font=Consolas]}
[/font][/color][color=#666600][font=Consolas]?>
[/font][/color]

 

That is a very basic and crude method but it works. If you decide to add more to it especially something like using that variable to look up something in a DB or local files on your server, I'd sanitize it and do some checking to make sure it is a valid YT video.

 

'Song Title' I would honestly leave out and find some way of parsing the YT video for its own title unless you have some other specific use. In which case rather than having it part of the URL I'd either have an on-server database table or even a simple text or csv file that parses the YT id's into song titles.

 

It's really been EONS since I have delved into PHP so this is all a bit rusty for me, but if you need any more help I will do what I can. :)

  • Thanks 1
Link to comment
Share on other sites

saint, Couldn't you just make a drop down menu and have the videos open in a frame, just below the menu? If you made the text large enough in the menu you could for example place it in the center of the page and display the video that was selected under it. Thinking about a Select Option/Menu might be better than a drop down. That way you don't need a database or a lot of coding.
"I'm Retired" Donations PayPal.Me/artistview . I only do dry reads, if you want FX's you'll have to add them, I might add them. If you use my voice please link to my art site AbstractArtist.xyz, Thank you
Link to comment
Share on other sites

Sorry it took so long to reply. Really had to go digging into my archives as this technique I used to use ad-nauseum on every site I developed.

 

The basis of it is actually pretty easy once you figure it out. Here's a small snippet example to go on:

[/font][/color][color=#000088][font=Consolas]if[/font][/color][color=#666600][font=Consolas](![/font][/color][color=#000000][font=Consolas]isset[/font][/color][color=#666600][font=Consolas]([/font][/color][color=#000000][font=Consolas]$_GET[/font][/color][color=#666600][font=Consolas][[/font][/color][color=#008800][font=Consolas]'ytid'[/font][/color][color=#666600][font=Consolas]])[/font][/color][color=#666600][font=Consolas]{
[/font][/color][font=Consolas][color=#000000]echo "No Video here!"; // Insert default content for no video id being specified here[/color][color=#880000]
[/color][/font][color=#666600][font=Consolas]}[/font][/color][color=#000088][font=Consolas]else[/font][/color][color=#666600][font=Consolas]{
[/font][/color][color=#000000][font=Consolas]$ytid [/font][/color][color=#666600][font=Consolas]=[/font][/color][color=#000000][font=Consolas] $_GET[/font][/color][color=#666600][font=Consolas][[/font][/color][color=#008800][font=Consolas]'ytid'[/font][/color][color=#666600][font=Consolas]];
?>

[/font][/color][color=#666600][font=Consolas]}
[/font][/color][color=#666600][font=Consolas]?>
[/font][/color]

 

That is a very basic and crude method but it works. If you decide to add more to it especially something like using that variable to look up something in a DB or local files on your server, I'd sanitize it and do some checking to make sure it is a valid YT video.

 

'Song Title' I would honestly leave out and find some way of parsing the YT video for its own title unless you have some other specific use. In which case rather than having it part of the URL I'd either have an on-server database table or even a simple text or csv file that parses the YT id's into song titles.

 

It's really been EONS since I have delved into PHP so this is all a bit rusty for me, but if you need any more help I will do what I can. :)

 

Bet me to it! Was going to write something up like this haha.

Studiio - All-In-One Radio Communication Platform
SMS | Phone Calls | Social Media | Content

Link to comment
Share on other sites

Okay guys - here is the code that I will use.

 

<?php

if(!isset($_GET['ytid']){

echo "No Video here!"; // Insert default content for no video id being specified here

}else{

$ytid = $_GET['ytid'];

?>

<?php echo "src="http://www.youtube.com/embed/ . $ytid . ";

}

?>

 

I will name the PHP file - music

 

I can load the youtube video from a clickable url link - such as this - correct ?

 

"http://www.mydomain.com/music.php?youtube_id"

 

youtube_id would be the actual id from the youtube video.

 

Just wanting to make sure I get all my ducks in a row - thanks all.

Link to comment
Share on other sites

Okay guys - here is the code that I will use.

 

<?php

if(!isset($_GET['ytid']){

echo "No Video here!"; // Insert default content for no video id being specified here

}else{

$ytid = $_GET['ytid'];

?>

<?php echo "src="http://www.youtube.com/embed/ . $ytid . ";

}

?>

 

I will name the PHP file - music

 

I can load the youtube video from a clickable url link - such as this - correct ?

 

"http://www.mydomain.com/music.php?youtube_id"

 

youtube_id would be the actual id from the youtube video.

 

Just wanting to make sure I get all my ducks in a row - thanks all.

 

Just tidied up that for you :)

Should work now.

 

if(!isset($_GET['ytid']){
echo "No Video here!";
} else {
$ytid = $_GET['ytid'];
?>

}
?>

  • Thanks 1

Studiio - All-In-One Radio Communication Platform
SMS | Phone Calls | Social Media | Content

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...