!MNc99 Posted May 9, 2009 Share Posted May 9, 2009 Hi there; Before we begin I know how annoying it is to have someone coming and ask someone else do all the work for them; I'm pretty much a complete PHP virgin and the best way for me to learn code is essentially to steal other people's and work from it. Not a good technique, I know. Regardless- if you do have a solution, bless you, but please, explain any technical language because I suck. Cheers! I have a very simply website showcasing a few flash animations. I've designed a page with image wrappers and my intention is to place a movie inside it loaded by an outside variable which will be placed inbetween the images so it looks like the animation is coming from inside a TV set. The basis for the address would be http://www.example.com/animations/player.php?id=1 With player.php being the page designed with the wrapper and 1 being an ID for some movie. As of yet the only thing I can say I actually have materialised is the wrapper page because I'm more designer than coder. So- from the ground up, how do I go about doing this? Any replies gratefully received. Even ones regarding my mother. !MNc99 Quote Link to comment https://forums.phpfreaks.com/topic/157528-php-newbie-help-playerphpidx/ Share on other sites More sharing options...
gevans Posted May 9, 2009 Share Posted May 9, 2009 I'm guessing you want to do this without a database or anything. I think what you're looking for is something like this... <?php /** * This array is setting the animation that you want to allow * We will use the key to reference them, so passing the key in the url * player.php?id=animation1 */ $allowedAnimations = array( "animation1" => "the-animation-1-src.avi", "animation2" => "the-animation-2-src.wmv", "animation3" => "the-animation-3-src.mpeg" ); /** * Here we'll check if id is set in the url * If it is we'll check it against the array * If it's not in the array we'll re-direct to the home page */ if(isset($_GET['id'])) { if(array_key_exists($_GET['id'], $allwoedAnimations)) { //Found an animation, lets get the source $animation = $allowedAnimations[$_GET['id']]; } else { //Array key doesn't exist, get him outta here header("Location: /index.php"); exit; } } else { header("Location: /index.php"); exit; } /** * Next you need to put the src in the relevant place in your embed code * I'll leave that up to you (though here is a little example) */ $animationScript = <<<EOD <OBJECT id="VIDEO" width="320" height="240" style="position:absolute; left:0;top:0;" CLASSID="CLSID:6BF52A52-394A-11d3-B153-00C04F79FAA6" type="application/x-oleobject"> <PARAM NAME="URL" VALUE="$animation"> <PARAM NAME="SendPlayStateChangeEvents" VALUE="True"> <PARAM NAME="AutoStart" VALUE="True"> <PARAM name="uiMode" value="none"> <PARAM name="PlayCount" value="9999"> </OBJECT> EOD; After that you just need to echo $animationScript in the correct place on your page. None of this is tested but should give you a good start! Quote Link to comment https://forums.phpfreaks.com/topic/157528-php-newbie-help-playerphpidx/#findComment-830553 Share on other sites More sharing options...
!MNc99 Posted May 9, 2009 Author Share Posted May 9, 2009 That's fantastic, gevans. Many thanks. One question, though- do both bits of code go on the same page? Where are they meant to be, and should both be in player.php in the <head> tag or something? I understand I'm meant to use an embed $animationScript tag at some point inbetween my wrapper images- that seems simple enough, I'll google it later- but where would the code that is referring to go? Other than that, it's solid. Thanks! Quote Link to comment https://forums.phpfreaks.com/topic/157528-php-newbie-help-playerphpidx/#findComment-830594 Share on other sites More sharing options...
gevans Posted May 9, 2009 Share Posted May 9, 2009 When you say both bits of code what are you referring to? That should all be on player.php and the $animationScript variable should be echo'd wherever you want the animation to play Quote Link to comment https://forums.phpfreaks.com/topic/157528-php-newbie-help-playerphpidx/#findComment-830596 Share on other sites More sharing options...
!MNc99 Posted May 9, 2009 Author Share Posted May 9, 2009 Oh, I see, I think. I'll let you know. (I really should have taken a look at some PHP before I dived head-first, but this seems comprehensive enough. cheers!) Quote Link to comment https://forums.phpfreaks.com/topic/157528-php-newbie-help-playerphpidx/#findComment-830597 Share on other sites More sharing options...
!MNc99 Posted May 10, 2009 Author Share Posted May 10, 2009 Good christ, it works! You are the man. Thank you so much. There is one minor thing I have issue with; I wonder if you could lend a hand? http://mnc99.com/animation/player.php?id=example This is the player, working like a charm. Notice, however, the two tiny gaps on both sides of the script. Dreamweaver seems to hate scrunching things up and will always endeavour to place minute gaps in, especially where they break the look of things. Is there anything I can do to axe them? (I'm using the Opera browser.) Thanks for all your help! Quote Link to comment https://forums.phpfreaks.com/topic/157528-php-newbie-help-playerphpidx/#findComment-830618 Share on other sites More sharing options...
!MNc99 Posted May 10, 2009 Author Share Posted May 10, 2009 Sorry for the double-post. It won't let me edit further. -I have also just noticed that the page seems to want to work in Opera exclusively. In Internet Explorer it just loads a white screen with a gap at the BOTTOM as well (although all these annoying gaps dissipate if I use 'compatibility view') and in Firefox it refuses to load the SWF at all. Could someone else try these out and see if it isn't just a problem on my end? http://mnc99.com/animation/player.php?id=example Quote Link to comment https://forums.phpfreaks.com/topic/157528-php-newbie-help-playerphpidx/#findComment-830630 Share on other sites More sharing options...
bloodgoat Posted May 10, 2009 Share Posted May 10, 2009 Umm. Try coding your template in table format and use cellpadding="0" and cellspacing="0". Quote Link to comment https://forums.phpfreaks.com/topic/157528-php-newbie-help-playerphpidx/#findComment-830635 Share on other sites More sharing options...
!MNc99 Posted May 10, 2009 Author Share Posted May 10, 2009 Good idea. Quote Link to comment https://forums.phpfreaks.com/topic/157528-php-newbie-help-playerphpidx/#findComment-830637 Share on other sites More sharing options...
!MNc99 Posted May 10, 2009 Author Share Posted May 10, 2009 Grand! that fixes that. Many thanks, bloodgoat. I still have this damn compatibility problem though, and it's unsettling. Is anyone getting these animations to load under IE or Firefox? Quote Link to comment https://forums.phpfreaks.com/topic/157528-php-newbie-help-playerphpidx/#findComment-830642 Share on other sites More sharing options...
.josh Posted May 10, 2009 Share Posted May 10, 2009 I would suggest using proper flash object/param/embed html. different browsers load it up differently. Google imbedding swf. Quote Link to comment https://forums.phpfreaks.com/topic/157528-php-newbie-help-playerphpidx/#findComment-830646 Share on other sites More sharing options...
!MNc99 Posted May 10, 2009 Author Share Posted May 10, 2009 Ok, here's where I am at the moment. <?php { $animationScript = <<<EOD <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="550" height="400"> <param name="URL" value="$animation"> <param name="quality" value="high"> <embed src="$animation" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="550" height="400"></embed></object> EOD; echo ($animationScript); } ?> This results in an SWF animation that displays fine in Opera and Firefox. Internet Explorer, however, displays only a white box bearing the dreaded 'Movie not loaded..' legend. Could anyone take a look at the code and see if there isn't some terrible mistake I've made? I hate asking for help, it seems so lazy on my part, but I'm at my wit's end on this one. Many thanks. Quote Link to comment https://forums.phpfreaks.com/topic/157528-php-newbie-help-playerphpidx/#findComment-831093 Share on other sites More sharing options...
gevans Posted May 10, 2009 Share Posted May 10, 2009 I would suggest using proper flash object/param/embed html. different browsers load it up differently. Google imbedding swf. Take a look at crayon violent's post Quote Link to comment https://forums.phpfreaks.com/topic/157528-php-newbie-help-playerphpidx/#findComment-831202 Share on other sites More sharing options...
!MNc99 Posted May 10, 2009 Author Share Posted May 10, 2009 gevans, see how the code you originally gave me has deviated in my next post. This is as far as I have managed to come and it works, but only on two browsers. Just 'use the right code' isn't much help in my current position. Quote Link to comment https://forums.phpfreaks.com/topic/157528-php-newbie-help-playerphpidx/#findComment-831239 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.