Jump to content

[SOLVED] How to load a flash based on month.


perficut

Recommended Posts

I own a landscape company and am in the middle of re-doing our web site.  I have an .swf file which display some of our services.

 

I'd like to make one for each month of the year (which would promote the next months services) and have it be displayed automaticaly. Each .swf file would be named the appropriate month.

 

In other words. How do I load a file based on the current month?   

 

Any help you can give is greatly appreciated. :)

date is what you want to look into along with switch or simple an if/elseif/else

 

EDIT:

Just noticed that the .swf is associated with the month name. If this is the case date should be all you need.

 

<?php
$month = date('F');

$flash = $month . ".swf";
?>

I tried this and although I am sure it is capturing the right month I dont think I am calling the flash file correctly.

 

I was trying the echo command and that apparently doesnt work.

 

Echo actually returns   " February.swf " instead of the actual file.

 

also tried

 

header("Content-type: application/x-shockwave-flash");

fpassthru($flash);

Right, it is suppose to return the filename, are you sure that the f in February on your file name is caps? If on a UNIX server, that will matter. If it is not caps on the server, use strtolower to make it all small case.

 

Also make sure that you direct to the path where that swf is actually located. If it is located in /flashmonths/ and script is in / you need to add that portion to it as well.

heres what I have.

<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" 
codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/ 
swflash.cab#version=6,0,29,0" width="520" height="347"> 
<param name="movie" value="February.swf"> 
<param name=quality value=high> 
<embed src="February.swf" quality=high 
pluginspage="http://www.macromedia.com/shockwave/download/index.cgi 
?P1_Prod_Version=ShockwaveFlash" 
type="application/x-shockwave-flash" width="520" height="347"></embed> 
</object>

 

This works fine.  But when I change February.swf to $flash  I get a blank flash screen.  the movie doesnt play but I dont get any error messages either. 

Better yet, here is the whole file. 

 

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Untitled Document</title>
<style type="text/css">
<!--
.style1 {color: #AA8259}
-->
</style>
</head>

<body>
<table width="528"  border="1" cellpadding="0">
  <tr>
    <td colspan="4"><?php
$month = date('F');

$flash = $month . ".swf";
?></td>
  </tr>
  <tr>
    <td width="57%" colspan="4"><object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" 
codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/ 
swflash.cab#version=6,0,29,0" width="520" height="347"> 
<param name="movie" value="$flash"> 
<param name=quality value=high> 
<embed src="February.swf" quality=high 
pluginspage="http://www.macromedia.com/shockwave/download/index.cgi 
?P1_Prod_Version=ShockwaveFlash" 
type="application/x-shockwave-flash" width="520" height="347"></embed> 
</object>
</td>
  </tr>
</table>
<h1 class="style1"> </h1>
</body>
</html>

You are only placing $flash in half the picture and you are not echoing it out.

 

<param name="movie" value="<?php echo $flash;?>">
<param name=quality value=high>
<embed src="<?php echo $flash;?>" quality=high 

 

Try that and see what happens.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.