saint Posted November 12, 2013 Share Posted November 12, 2013 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 ! Relaxing Entertainment For The World - - www.ScenicRadio.com Link to comment Share on other sites More sharing options...
cr08 Posted November 16, 2013 Share Posted November 16, 2013 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. Link to comment Share on other sites More sharing options...
saint Posted November 16, 2013 Author Share Posted November 16, 2013 Thank You Good Sir :D Relaxing Entertainment For The World - - www.ScenicRadio.com Link to comment Share on other sites More sharing options...
billh Posted November 16, 2013 Share Posted November 16, 2013 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 More sharing options...
James Posted November 17, 2013 Share Posted November 17, 2013 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 More sharing options...
saint Posted November 17, 2013 Author Share Posted November 17, 2013 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. Relaxing Entertainment For The World - - www.ScenicRadio.com Link to comment Share on other sites More sharing options...
James Posted November 18, 2013 Share Posted November 18, 2013 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']; ?> } ?> Studiio - All-In-One Radio Communication Platform SMS | Phone Calls | Social Media | Content Link to comment Share on other sites More sharing options...
saint Posted November 18, 2013 Author Share Posted November 18, 2013 Thanks so much James It just dawned on me that I hard coded the youtube id number in the script and i didnt need to do that. Relaxing Entertainment For The World - - www.ScenicRadio.com Link to comment Share on other sites More sharing options...
saint Posted November 18, 2013 Author Share Posted November 18, 2013 How do I direct the php script to embed the youtube video on a specific page ? I have a page designated as a link index - where i list the urls however I want the videos to display on a different page. Sorry for being a complete noob and thanks for having patience Relaxing Entertainment For The World - - www.ScenicRadio.com Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.