Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Nov 2010
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Open Flash File for current page

    I've been searching and searching and trying out different things, but I cannot find/get anything to work!

    Basically, what I need is for when the user visits, say, "www.mypage.net/flashpage.php?=blah", the Flash object HTML "<object ..." will make the file "www.mypage.net/files/blah.swf" be the Flash file.

    I've seen this done before... I just have no idea how to do it!

    Could someone point me in the right direction...

  • #2
    Master Coder mlseim's Avatar
    Join Date
    Jun 2003
    Location
    Cottage Grove, Minnesota
    Posts
    9,380
    Thanks
    8
    Thanked 1,075 Times in 1,066 Posts
    Example URL:
    www.mypage.net/flashpage.php?file=blah

    PHP Code:
    <?php

    // set a default in case they enter without a file specified
    $file="noshow.swf";

    // if they entered a file, use it.
    if($_GET['file']){
    $file=$_GET['file'].".swf";
    }

    // now, you should make sure the file exists.
    $check="www.mypage.net/files/$file";
    if(
    file_exists($check)){
    // it's OK
    }
    else{
    // it does not exist, so use the default.
    $file="noshow.swf";
    }

    // now you continue on with your page ... 
    // you'll use the $file variable later on, in your HTML.
    ?>

    <html>
    <body>
    blah blah blah
    <object ... stuff stuff src="www.mypage.net/files/<?=$file?>" ... stuff stuff>
    </object>
    </body>
    </html>


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •