Not signed in (Sign In)

Vanilla 1.0.3 is a product of Lussumo. More Information: Documentation, Community Support.

    • CommentAuthorsophistikat
    • CommentTimeJun 27th 2007 edited
     
    is getQueryParamValue() my only method of retrieving the address bar variables?
    i want to use php's QueryString Collection (<?php echo($_SERVER['QUERY_STRING']); ?>) to get all variables.
    • CommentAuthorphilip
    • CommentTimeJun 27th 2007 edited
     
    you can use any server-side method you like... getQueryParamValue() is simply a convenient way to do it with JavaScript.

    SWFObject's JavaScript method:

    so.addVariable("variable1", getQueryParamValue("variable1"));
    so.addVariable("variable2", getQueryParamValue("variable2"));


    you could also use PHP variables, but you should build some checks into your PHP to make sure you don't hit any nulls or missing parameters:

    <?php
    if($_GET['var1']) {
    echo "so.addVariable('variable1', $_GET['var1']);";
    }
    ?>


    or maybe

    <?php
    foreach($_GET as $variable => $value)
    {
    echo "so.addVariable('$variable', '$value');";
    }
    ?>


    or

    <?php
    $var1 = "nothing";
    if($_GET['var1']) {
    $var1 = $_GET['var1'];
    }
    ?>
    so.addVariable("variable1", "<?php echo $var1; ?>");


    same goes for ASP:

    so.addVariable("variable1", "<%= var1 %>");
    so.addVariable("variable2", "<%= var2 %>");


    and ASP.Net:

    so.addVariable("variable1", "<% Response.Write(var1); %>");
    so.addVariable("variable2", "<% Response.Write(var2); %>");


    there are many ways to do it, you're limited only by your imagination! and maybe weird security issues :)

    - philip
    • CommentAuthorsophistikat
    • CommentTimeJun 27th 2007 edited
     
    sorry but thats not were i wanted my question to go. i want to pass all the variables from the address and not just one by one.
    ie. the url may be www.mysite.com/vars.php?var1=abc&var2=def&var3=ghi&var1=abc&var2=def&var3=ghi&var1=abc&var2=def&var3=ghi&var1=abc&var2=def&var3=ghi

    you may never know how many variables you'll receive so i want to a pass all of theme

    something like:
    so.addVariables( <?php echo($_SERVER['QUERY_STRING']); ?> );

    or

    so.addVariables('FlashVars', <?php echo($_SERVER['QUERY_STRING']); ?> );
    • CommentAuthorphilip
    • CommentTimeJun 27th 2007 edited
     
    read my post again... the answer is in there. :)


    <script type="text/javascript">
    var so = new SWFObject("movie.swf", "mymovie", "400", "200", "8", "#336699");
    <?php
    foreach($_GET as $variable => $value) {
    echo "so.addVariable('$variable', '$value');";
    }
    ?>
    so.write("flashcontent");
    </script>


    this dynamically creates a SWFObject variable entry for each querystring item, regardless of how many variables are in the querystring. no muss, no fuss...
    • CommentAuthorphilip
    • CommentTimeJun 27th 2007
     
    here's a quickie sample page to demonstrate my code:
    http://pipwerks.com/lab/swfobject/querystrings/index.php

    - philip
    • CommentAuthorsophistikat
    • CommentTimeJun 27th 2007 edited
     
    If you could see me right now you would see me facing the corner with a dunce cap.

    I had a major blonde moment.

    Thanks a lot, I have no idea how i missed read your email.
    • CommentAuthorphilip
    • CommentTimeJun 27th 2007
     
    no prob. :)