PHP in the <embed> tag.....is this possible?

Discussion in 'PHP' started by jpmad4it, Mar 27, 2007.

  1. #1
    Hi everyone,

    I have a flash banner rotator that runs using PHP at the backend. The way in which the flash banner is called into the script is by using the following PHP:

    <? php include("http://www.mysite.com/banners"); ?>

    I have also used this in other ways such as:

    <?php $file = file_get_contents("http://www.mysite/banners"); ?>

    I am struggling to incorporate this into the <object> tag. Is there a way in which I can do this? Can I somehow get this to work in the <param name="movie"> tag? Or is there some other method that I can use?

    I should also mention that the file I am working with is a 'tpl' file. I do not think that these support PHP, but I may be wrong.

    Any help would be great as I am really struggling with this one.

    Kind regards,
    Jp
     
    jpmad4it, Mar 27, 2007 IP
  2. krakjoe

    krakjoe Well-Known Member

    Messages:
    1,795
    Likes Received:
    141
    Best Answers:
    0
    Trophy Points:
    135
    #2
    well it'll be banners/index.php just set the source of the object to the absolute path to the php script and it'll work just fine.
     
    krakjoe, Mar 27, 2007 IP
  3. jpmad4it

    jpmad4it Peon

    Messages:
    29
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Hello there, thanks for the reply.

    I tried the absolute path already and it didn't work......I really thought that it would but it doesn't???? It's very strange?? :confused:

    I have the code like this, maybe its wrong??

     
    jpmad4it, Mar 27, 2007 IP
  4. krakjoe

    krakjoe Well-Known Member

    Messages:
    1,795
    Likes Received:
    141
    Best Answers:
    0
    Trophy Points:
    135
    #4
    can you post an actual link to this index.php; if the index.php outputs this object tag you'll need to do it another way
     
    krakjoe, Mar 27, 2007 IP
  5. jpmad4it

    jpmad4it Peon

    Messages:
    29
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    I'll PM the absolute link to you :)

    If you reply here it would be great!!!!
     
    jpmad4it, Mar 27, 2007 IP
  6. krakjoe

    krakjoe Well-Known Member

    Messages:
    1,795
    Likes Received:
    141
    Best Answers:
    0
    Trophy Points:
    135
    #6
    replace

    
    <object classid="clsid27CDB6E-AE6D-11cf-96B8-444553540000" codebase= 
    "http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="468" height="60" class="flash">
    <param name="movie" value="http://www.mysite.com/banners/index.php" />
    <param name="quality" value="high" />
    <embed src="http://www.mysite.com/banners/index.php" quality="high" 
    pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="468" height="60"> </embed>
    </object> 
    
    Code (markup):
    with

    
    <?=file_get_contents("http://you.know.the.url") ?>
    
    PHP:
    That should work.
     
    krakjoe, Mar 27, 2007 IP
  7. jpmad4it

    jpmad4it Peon

    Messages:
    29
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #7
    Ah it didnt work.....gutted.

    I think that the .tpl files work with a php file at the backend which passes the information to the tpl file. I'm not 100% sure. The site I am trying to get the Flash banner to work in uses Cubecart as its major coding system....are you familiar with that at all? Maybe I have to add the PHP to the index.php file, and then pass the info to the index.tpl file? hmmm tricky. :rolleyes:
     
    jpmad4it, Mar 27, 2007 IP
  8. krakjoe

    krakjoe Well-Known Member

    Messages:
    1,795
    Likes Received:
    141
    Best Answers:
    0
    Trophy Points:
    135
    #8
    yeah do that, get the data into a var that can be used by the tpl then pass it before you output the page.
     
    krakjoe, Mar 27, 2007 IP
  9. jpmad4it

    jpmad4it Peon

    Messages:
    29
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #9

    How ? :eek:

    I am rubbish at coding :(
     
    jpmad4it, Mar 27, 2007 IP
  10. jpmad4it

    jpmad4it Peon

    Messages:
    29
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #10
    I added this code to the index.php file:

    include("http://www.mysite.com/banners/index.php");
    $body->assign("FLASH_ROT",$box_content);

    And when i view the webpage the banner rotator is there! My problem is now trying to position the flash using CSS - the problem is that the rotator just sits right at the top of the page and seems to ignore any CSS command i apply to it??
     
    jpmad4it, Mar 28, 2007 IP
  11. jpmad4it

    jpmad4it Peon

    Messages:
    29
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #11
    WHAY! I did it :D

    It works!

    I added this code to the index.php file:

    $file = file_get_contents("http://www.mysite.com/banners");
    $body->assign("FLASH_ROT", $file);

    And then called it in index.tpl using {FLASH_ROT}

    I'm chuffed with myself LOL
     
    jpmad4it, Mar 28, 2007 IP