Function returns nothing (instead of flash)

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • knoak

    Function returns nothing (instead of flash)

    Hi there,

    I have a site with just a few pages. (e.g. home.php)
    In every page there is another page included with things
    like the header etc.

    The included file is in a subdirectory called "include".
    There are two functions written in this included file:

    =============== =============== =============== =============== ===============
    function doImage($image)
    {
    list($width, $height, $type, $attr) = getimagesize($i mage);
    echo "<img src=$image width=\"$width\ " height=\"$heigh t\">";
    };

    function doFlash($Movie, $Height,$Width)
    {
    echo "<object classid=\"clsid :D27CDB6E-AE6D-11cf-96B8-444553540000\"
    codebase=\"http ://download.macrom edia.com/pub/shockwave/cabs/flash/swflash.cab#ver sion=6,0,29,0\"
    height=\"$Heigh t\" width=\"$Width\ ">
    <param name=\"movie\" value=\"$Movie\ ">
    <param name=\"quality\ " value=\"high\">
    <param name=\"allowsca le\" value=\"true\">
    <param name=\"SCALE\" value=\"exactfi t\">
    <param name=\"menu\" value=\"false\" >
    <param name=\"wmode\" value=\"transpa rent\">
    <embed src=\"$Movie\" width=\"$Width\ " height=\"$Heigh t\"
    menu=\"false\" wmode=\"transpa rent\" allowscale=\"tr ue\"
    scale=\"exactfi t\" quality=\"high\ "
    pluginspage=\"h ttp://www.macromedia. com/go/getflashplayer\ "
    type=\"applicat ion/x-shockwave-flash\"></embed>
    </object>";
    };
    =============== =============== =============== =============== ===============

    I call the functions from pages in the root directory, pages like
    home.php...

    When i call doImage("img/logo.gif"); it works well, but when i
    call doFlash("swf/logo.swf","100p x","100px"); It returns everything
    before
    the <html> tag starts, so it isn't in the right place either. When i
    change
    the "echo"-statement of doFlash() to "return" nothing happens and it
    disappears in the source (online)

    What am i doing wrong?

    Hope someone can help...

    Greetings knoakske
  • Ben Cottrell

    #2
    Re: Function returns nothing (instead of flash)

    knoak wrote:
    [color=blue]
    > Hi there,
    >
    > I have a site with just a few pages. (e.g. home.php)
    > In every page there is another page included with things
    > like the header etc.
    >
    > The included file is in a subdirectory called "include".
    > There are two functions written in this included file:
    >
    > =============== =============== =============== =============== ===============
    > function doImage($image)
    > {
    > list($width, $height, $type, $attr) = getimagesize($i mage);
    > echo "<img src=$image width=\"$width\ " height=\"$heigh t\">";
    > };
    >
    > function doFlash($Movie, $Height,$Width)
    > {
    > echo "<object classid=\"clsid :D27CDB6E-AE6D-11cf-96B8-444553540000\"
    > codebase=\"http ://download.macrom edia.com/pub/shockwave/cabs/flash/swflash.cab#ver sion=6,0,29,0\"
    > height=\"$Heigh t\" width=\"$Width\ ">
    > <param name=\"movie\" value=\"$Movie\ ">
    > <param name=\"quality\ " value=\"high\">
    > <param name=\"allowsca le\" value=\"true\">
    > <param name=\"SCALE\" value=\"exactfi t\">
    > <param name=\"menu\" value=\"false\" >
    > <param name=\"wmode\" value=\"transpa rent\">
    > <embed src=\"$Movie\" width=\"$Width\ " height=\"$Heigh t\"
    > menu=\"false\" wmode=\"transpa rent\" allowscale=\"tr ue\"
    > scale=\"exactfi t\" quality=\"high\ "
    > pluginspage=\"h ttp://www.macromedia. com/go/getflashplayer\ "
    > type=\"applicat ion/x-shockwave-flash\"></embed>
    > </object>";
    > };
    > =============== =============== =============== =============== ===============
    >
    > I call the functions from pages in the root directory, pages like
    > home.php...
    >
    > When i call doImage("img/logo.gif"); it works well, but when i
    > call doFlash("swf/logo.swf","100p x","100px"); It returns everything
    > before
    > the <html> tag starts, so it isn't in the right place either. When i
    > change
    > the "echo"-statement of doFlash() to "return" nothing happens and it
    > disappears in the source (online)[/color]

    It will disappear .. by removing "echo", you're telling PHP *not* to
    put the code into the end webpage. "return" just makes the function
    return a value, so that it's available to be used in another part of
    your code.. If you wish to echo that return value, you must specify
    when calling the function that you want to echo it's return value.

    (Think of the return value of a function in the same way you would think
    of a constant variable)
    [color=blue]
    > What am i doing wrong?
    >
    > Hope someone can help...
    >
    > Greetings knoakske[/color]


    --
    Ben Cottrell AKA Bench

    Disclaimer:
    This post may contain explicit depictions of things which are "real".
    These "real" things are commonly known as 'life'! So, if it sounds
    sarcastic, don't take it seriously. If it sounds hazardous, Do not try
    this at home or at all. And if it offends you, just don't read it.

    Comment

    • knoak

      #3
      Re: Function returns nothing (instead of flash)

      I'm sorry, but this doesn't solve anything for me...
      As you've probably noticed, i'm a newbie..

      But anyway, what i can't figure, is why the doImage(); works
      perfect, and the doFlash(); refuses to work..

      What should i do then to fix it?

      Thanks in advance..

      Greetings knoak

      Comment

      • Pjotr Wedersteers

        #4
        Re: Function returns nothing (instead of flash)

        knoak wrote:[color=blue]
        > Hi there,
        >
        > I have a site with just a few pages. (e.g. home.php)
        > In every page there is another page included with things
        > like the header etc.
        >
        > The included file is in a subdirectory called "include".
        > There are two functions written in this included file:
        >
        >[/color]
        =============== =============== =============== =============== ===============[color=blue]
        > function doImage($image)
        > {
        > list($width, $height, $type, $attr) = getimagesize($i mage);
        > echo "<img src=$image width=\"$width\ " height=\"$heigh t\">";
        > };
        >
        > function doFlash($Movie, $Height,$Width)
        > {
        > echo "<object classid=\"clsid :D27CDB6E-AE6D-11cf-96B8-444553540000\"
        >[/color]
        codebase=\"http ://download.macrom edia.com/pub/shockwave/cabs/flash/swflash.c
        ab#version=6,0, 29,0\"[color=blue]
        > height=\"$Heigh t\" width=\"$Width\ ">
        > <param name=\"movie\" value=\"$Movie\ ">
        > <param name=\"quality\ " value=\"high\">
        > <param name=\"allowsca le\" value=\"true\">
        > <param name=\"SCALE\" value=\"exactfi t\">
        > <param name=\"menu\" value=\"false\" >
        > <param name=\"wmode\" value=\"transpa rent\">
        > <embed src=\"$Movie\" width=\"$Width\ " height=\"$Heigh t\"
        > menu=\"false\" wmode=\"transpa rent\" allowscale=\"tr ue\"
        > scale=\"exactfi t\" quality=\"high\ "
        > pluginspage=\"h ttp://www.macromedia. com/go/getflashplayer\ "
        > type=\"applicat ion/x-shockwave-flash\"></embed>
        > </object>";
        > };
        >[/color]
        =============== =============== =============== =============== ===============[color=blue]
        >
        > I call the functions from pages in the root directory, pages like
        > home.php...
        >
        > When i call doImage("img/logo.gif"); it works well, but when i
        > call doFlash("swf/logo.swf","100p x","100px"); It returns everything
        > before
        > the <html> tag starts, so it isn't in the right place either. When i
        > change
        > the "echo"-statement of doFlash() to "return" nothing happens and it
        > disappears in the source (online)
        >
        > What am i doing wrong?
        >
        > Hope someone can help...
        >
        > Greetings knoakske[/color]

        I really am surprised it doesn't work, I copy-pasted the function in my php
        editor, and called the function with a local swf and it runs as expected. So
        this leads me to believe the code itself is correct. Even if the .swf is
        missing the page loads, allbeit it keeps looking for the missing
        movieclip... Anything else you can think of that might be involved ? The way
        the includes are handled ? The way PHP handles escaped chars or something ?
        My PHP is a default setup, as it comes preinstalled with apache on my suse
        9.0 linux machine.
        (Apache 2.048 and PHP 4.3.3)

        Sorry i can't be of more help.
        Pjotr


        Comment

        • knoak

          #5
          Re: Function returns nothing (instead of flash)

          Hi there, i'm running
          PHP 4.3.3 on Linux, that's all i can figure out.

          I'll re-explain the structure, maybe that's where it goes wrong..


          _root -> home.php*, contact.php*, etc.*

          folder "inc"-> standards.php, which also has the functions in it.


          *in all the first line = include_once('i nc/standards.php') ;)

          I call the function in standards.php from home.php by the following
          command: <?php doFlash("swf/logo.swf","100" ,"100"); ?>

          What i don't get is that the doImage() works fine in home.php.
          The only difference is that doImage() has
          "list($widt h, $height, $type, $attr) = getimagesize($i mage);"
          before echoing something, could the flaw be somewhere in this part then?

          Thanks in advance,

          Greetings knoak

          Comment

          • knoak

            #6
            Re: Function returns nothing (instead of flash)

            anyone?

            Comment

            • Pjotr Wedersteers

              #7
              Re: Function returns nothing (instead of flash)

              knoak wrote:[color=blue]
              > anyone?[/color]
              I'm sorry knoak, I can't reproduce it. I simply have no clue.
              Pjotr


              Comment

              • knoak

                #8
                Re: Function returns nothing (instead of flash)

                Crap!

                Thanks anyway, i'll try something else then..

                Greetings

                Comment

                Working...