Dynamic source with PHP variable, is it possible?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Haitashi
    New Member
    • Jun 2007
    • 96

    Dynamic source with PHP variable, is it possible?

    Code:
    <PARAM NAME=movie VALUE="headerMovie.swf"><PARAM NAME=quality VALUE=high><PARAM NAME=bgcolor VALUE=#FFFFFF><EMBED src="<?php $HEADER_FLASH?>" quality=high bgcolor=#FFFFFF WIDTH="1000" HEIGHT="173"
    NAME="headerMovie" ALIGN="" TYPE="application/x-shockwave-flash"
    PLUGINSPAGE="http://www.macromedia.com/go/getflashplayer"></EMBED>
    What I'm trying to do is set the "src" parameter dynamically. However, I don't know if that's possible. Can I use a PHP variable as a source? O.o

    THANKS!
  • Markus
    Recognized Expert Expert
    • Jun 2007
    • 6092

    #2
    Ofcourse you can, but you have to echo the contents of the variable into the source attribute.

    Code:
    <PARAM NAME=movie VALUE="headerMovie.swf"><PARAM NAME=quality VALUE=high><PARAM NAME=bgcolor VALUE=#FFFFFF><EMBED src="<?php echo $HEADER_FLASH?>" quality=high bgcolor=#FFFFFF WIDTH="1000" HEIGHT="173"
    NAME="headerMovie" ALIGN="" TYPE="application/x-shockwave-flash"
    PLUGINSPAGE="http://www.macromedia.com/go/getflashplayer"></EMBED>
    I should also add, for the standards lover in me, that elements and attributes should all be lowercase. So <PARAM NAME becomes <param name. It's not necessary, but your page won't validate otherwise.

    Good day.

    Comment

    • Haitashi
      New Member
      • Jun 2007
      • 96

      #3
      Great! I've been trying to use this on OSCommerce and I had to output the variable without the $ sign. I also removed the caps on the attributes. =)

      Thanks for the reply!

      Comment

      • Markus
        Recognized Expert Expert
        • Jun 2007
        • 6092

        #4
        Originally posted by Haitashi
        Great! I've been trying to use this on OSCommerce and I had to output the variable without the $ sign. I also removed the caps on the attributes. =)

        Thanks for the reply!
        Very welcome.

        Take care.

        Comment

        Working...