perficut Posted February 8, 2009 Share Posted February 8, 2009 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. Quote Link to comment https://forums.phpfreaks.com/topic/144400-solved-how-to-load-a-flash-based-on-month/ Share on other sites More sharing options...
premiso Posted February 8, 2009 Share Posted February 8, 2009 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"; ?> Quote Link to comment https://forums.phpfreaks.com/topic/144400-solved-how-to-load-a-flash-based-on-month/#findComment-757760 Share on other sites More sharing options...
perficut Posted February 8, 2009 Author Share Posted February 8, 2009 will give that a try. Thank you Quote Link to comment https://forums.phpfreaks.com/topic/144400-solved-how-to-load-a-flash-based-on-month/#findComment-757763 Share on other sites More sharing options...
grissom Posted February 8, 2009 Share Posted February 8, 2009 Then, having defined the variable $flash, when you get to your code to embed the flash file, just do something like : <embed src= "<?php echo $flash; ?>" width="550" height="400"> </embed> Quote Link to comment https://forums.phpfreaks.com/topic/144400-solved-how-to-load-a-flash-based-on-month/#findComment-757774 Share on other sites More sharing options...
perficut Posted February 9, 2009 Author Share Posted February 9, 2009 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); Quote Link to comment https://forums.phpfreaks.com/topic/144400-solved-how-to-load-a-flash-based-on-month/#findComment-757805 Share on other sites More sharing options...
premiso Posted February 9, 2009 Share Posted February 9, 2009 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. Quote Link to comment https://forums.phpfreaks.com/topic/144400-solved-how-to-load-a-flash-based-on-month/#findComment-757855 Share on other sites More sharing options...
perficut Posted February 9, 2009 Author Share Posted February 9, 2009 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. Quote Link to comment https://forums.phpfreaks.com/topic/144400-solved-how-to-load-a-flash-based-on-month/#findComment-758139 Share on other sites More sharing options...
perficut Posted February 9, 2009 Author Share Posted February 9, 2009 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> Quote Link to comment https://forums.phpfreaks.com/topic/144400-solved-how-to-load-a-flash-based-on-month/#findComment-758142 Share on other sites More sharing options...
premiso Posted February 9, 2009 Share Posted February 9, 2009 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. Quote Link to comment https://forums.phpfreaks.com/topic/144400-solved-how-to-load-a-flash-based-on-month/#findComment-758196 Share on other sites More sharing options...
perficut Posted February 9, 2009 Author Share Posted February 9, 2009 Looks like thats it. Thank you very much. Quote Link to comment https://forums.phpfreaks.com/topic/144400-solved-how-to-load-a-flash-based-on-month/#findComment-758300 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.