Xtreeme Posted November 9, 2007 Share Posted November 9, 2007 Sorry if in wrong place. IT would fit in few categories I guess. My problem is, I have a header (not a seperate frame!) that is used for each page on site. I want it to play once per visit or per hour whatever is easiest. Right now its doing the typical replay on each page link which is annoying. I could use jpeg for other pages however if you return to home it will play again still, frustraiting. I do have loop off already. I found some diff fixes none worked for me. I found playoncelogo but it is having issues (messing image up no matter size I set). SO I tried a session cookie method, which didnt work at all for me. I must be doing something simple wrong. Most instructions are really generic and lack details needed to folks like me (new to flash). I have heavily modded phpbb forums many times so I can code. Just not create it (dont laugh please haha). Can someone please guide me I really appreciate it- I have tried for 3 days and just about to give up on my animated header all together. To recap I would like header to load once per session (visit). Per hour would work aswell if easier to do. I have these two programs to work with Dreamweaver CS3 Adobe Flash CS3 Help me stay partially saine please. Thanks in advance. Quote Link to comment https://forums.phpfreaks.com/topic/76628-solved-php-site-help-getting-flash-banner-to-play-only-once-per-sesion/ Share on other sites More sharing options...
cooldude832 Posted November 9, 2007 Share Posted November 9, 2007 you want to use sessions, if they navigate away it might replay but oh well right. to the top of every page before any output (This is key) <?php session_start(); if($_SESSION['header'] == "yes"){ $show_header = "no"; } else{ $_SESSION['header'] = "yes"; } ?> Now when it comes to outputting the header do this in its container <?php if($show_header == "no"){ echo "<img src=\"header.jpg"\" alt=\"\" />"; } else{ echo "<img src=\"flashy_header.jpg\" alt=\"\" />"; } ?> so if you have the session set it will make $show_header = no and make it display the low quality header, else it displays the "Flashy Header", just mod the tags above to fit your images/flash docs and it will work, but it needs to be on every page Quote Link to comment https://forums.phpfreaks.com/topic/76628-solved-php-site-help-getting-flash-banner-to-play-only-once-per-sesion/#findComment-388004 Share on other sites More sharing options...
Xtreeme Posted November 9, 2007 Author Share Posted November 9, 2007 Great! Thank so much and super fast response too. I will let you know how it works. Ill try it now. Quote Link to comment https://forums.phpfreaks.com/topic/76628-solved-php-site-help-getting-flash-banner-to-play-only-once-per-sesion/#findComment-388009 Share on other sites More sharing options...
atlanta Posted November 9, 2007 Share Posted November 9, 2007 Also if you know how to code in flash you can get it to read the session and just just straight to the last frame of the flash movie... Not a flash coder but have seen it around do a quick search on google. Quote Link to comment https://forums.phpfreaks.com/topic/76628-solved-php-site-help-getting-flash-banner-to-play-only-once-per-sesion/#findComment-388014 Share on other sites More sharing options...
Xtreeme Posted November 9, 2007 Author Share Posted November 9, 2007 Im doing something wrong still I guess. This is being tested on uniform server. When I try the new code I get this error Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING, expecting ',' or ';' in W:\www\index2.php on line 37 This is line 37 in dreamweaver echo "<img src=\"logo.jpg"" alt=\"\" />"; Here is the top portion of the homepage, I didnt include all the code, but I will include it if needed. <?php session_start(); if($_SESSION['header'] == "yes"){ $show_header = "no"; } else{ $_SESSION['header'] = "yes"; } ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <!-- TemplateBeginEditable name="doctitle" --> <title>Home</title> <!-- TemplateEndEditable --> <!-- TemplateBeginEditable name="head" --><!-- TemplateEndEditable --> <link href="index.css" rel="stylesheet" type="text/css" /> <!--[if IE 5]> <style type="text/css"> /* place css box model fixes for IE 5* in this conditional comment */ .thrColAbsHdr #sidebar1 { width: 180px; } .thrColAbsHdr #sidebar2 { width: 190px; } </style> <![endif]--> <script src="Scripts/AC_RunActiveContent.js" type="text/javascript"></script> </head> <body class="thrColAbsHdr"> <div id="container"> <div id="header"> <?php if($show_header == "no"){ echo "<img src=\"logo.jpg"" alt=\"\" />"; } else{ echo "<img src=\"logo.swf\" alt=\"\" />"; } ?> <div id="tabsH"> <ul> <!-- CSS Tabs --> <li id="current"><a href="/index.php"><span>Home</span></a></li> <li><a href="http://forums.pctech-support.com"><span>Forums</span></a></li> <li><a href="/news/news_index.php"><span>News</span></a></li> <li><a href="/software.php"><span>Software</span></a></li> <li><a href="/links.php"><span>Links</span></a></li> <li><a href="/About.html"><span>About</span></a></li> </ul> </div> <!-- end #header --></div> Any advice? Thanks for all the help so far I really appreciate it. Quote Link to comment https://forums.phpfreaks.com/topic/76628-solved-php-site-help-getting-flash-banner-to-play-only-once-per-sesion/#findComment-388151 Share on other sites More sharing options...
Xtreeme Posted November 9, 2007 Author Share Posted November 9, 2007 Also if you know how to code in flash you can get it to read the session and just just straight to the last frame of the flash movie... Not a flash coder but have seen it around do a quick search on google. Ya that was the flash trick I found but I got no where with it. The code had to be put in first frame of flash which I did (prob wrong though). I used windows > actions and put the code there while having first frame selected. replay = SharedObject.getLocal("save"); if (replay.data.name == undefined){ gotoAndPlay(2); replay.data.name = "played"; } else { gotoAndStop(424); } 424 is last frame (its 30fps). But the end result was no change at all. Im totally new to flash so......illustrator and dreamweaver is all I have experience with from adobe. Quote Link to comment https://forums.phpfreaks.com/topic/76628-solved-php-site-help-getting-flash-banner-to-play-only-once-per-sesion/#findComment-388153 Share on other sites More sharing options...
Xtreeme Posted November 11, 2007 Author Share Posted November 11, 2007 I still cant figure that syntax error out I tried sever diff things. None worked. Its def in line 37 cause if I remove it, error goes away but of course it doesnt show the banner either. Any one have any ideas? ??? Quote Link to comment https://forums.phpfreaks.com/topic/76628-solved-php-site-help-getting-flash-banner-to-play-only-once-per-sesion/#findComment-388982 Share on other sites More sharing options...
Xtreeme Posted November 12, 2007 Author Share Posted November 12, 2007 once last bump before I give up! definatly something wrong in that code I entered just as instructed. EVEN just that data in a .php file with no webpage info cause same error-syntax error. Either something is out of order, typo'ed, etc. Anyone that doesnt believe me enter this into notepad and save as .php (watch the results "syntax error") <?php session_start(); if($_SESSION['header'] == "yes"){ $show_header = "no"; } else{ $_SESSION['header'] = "yes"; } ?> <?php if($show_header == "no"){ echo "<img src=\"header.jpg"" alt=\"\" />"; } else{ echo "<img src=\"flashy_header.jpg\" alt=\"\" />"; } ?> Quote Link to comment https://forums.phpfreaks.com/topic/76628-solved-php-site-help-getting-flash-banner-to-play-only-once-per-sesion/#findComment-390013 Share on other sites More sharing options...
GingerRobot Posted November 12, 2007 Share Posted November 12, 2007 You've got a duplicate double quote. Change this line: echo "<img src=\"header.jpg"" alt=\"\" />"; to: echo "<img src=\"header.jpg\" alt=\"\" />"; Edit: Or better yet, change the whole lot to: <?php if($show_header == "no"){ echo '<img src="header.jpg" alt="" />'; } else{ echo '<img src="flashy_header.jpg" alt="" />'; } ?> We don't need the double quotes to surround the string, since we're not echoing any variables. So lets use single quotes and make things a bit easier to read. Quote Link to comment https://forums.phpfreaks.com/topic/76628-solved-php-site-help-getting-flash-banner-to-play-only-once-per-sesion/#findComment-390014 Share on other sites More sharing options...
revraz Posted November 12, 2007 Share Posted November 12, 2007 echo "<img src=\"logo.jpg"" alt=\"\" />"; You're not escaping all the Quotes, just use: echo "<img src='logo.jpg' alt='\' />"; Quote Link to comment https://forums.phpfreaks.com/topic/76628-solved-php-site-help-getting-flash-banner-to-play-only-once-per-sesion/#findComment-390015 Share on other sites More sharing options...
Xtreeme Posted November 12, 2007 Author Share Posted November 12, 2007 Thanks guys! Im doing this right now. brb Quote Link to comment https://forums.phpfreaks.com/topic/76628-solved-php-site-help-getting-flash-banner-to-play-only-once-per-sesion/#findComment-390018 Share on other sites More sharing options...
Xtreeme Posted November 12, 2007 Author Share Posted November 12, 2007 O.K. that code works! yah! I have one issue Im sure is my fault. First visit not showing flash file just a x in a box (file not found?) When I refresh it DOES show the jpg now which is exactly what I want. My files are all in root which is drive w: (w:/logo.swf etc. etc.) flash file is named logo.swf jpg is named logo.jpg Here is the code Im using for test page- is it a flash thing now or a html/php thing Im overlooking here. <?php session_start(); if($_SESSION['header'] == "yes"){ $show_header = "no"; } else{ $_SESSION['header'] = "yes"; } ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Untitled Document</title> <?php if($show_header == "no"){ echo '<img src="logo.jpg" alt="" />'; } else{ echo '<img src="logo.swf" alt="" />'; } ?> </head> <body> </body> </html> Quote Link to comment https://forums.phpfreaks.com/topic/76628-solved-php-site-help-getting-flash-banner-to-play-only-once-per-sesion/#findComment-390045 Share on other sites More sharing options...
cooldude832 Posted November 12, 2007 Share Posted November 12, 2007 well cause your tag isn't right you can't call a flash file from an img src= "" you gotta use an embed or whatever you had before. Quote Link to comment https://forums.phpfreaks.com/topic/76628-solved-php-site-help-getting-flash-banner-to-play-only-once-per-sesion/#findComment-390049 Share on other sites More sharing options...
Xtreeme Posted November 12, 2007 Author Share Posted November 12, 2007 that makes sense in fact was first thing that came to mind cause its not a image at all (but google just confused me lol). I put the flash in just as before BUT it gave me two headers heh. The static one above and the flash one playing below it. I just removed the img source line, in dreamweaver put in the flash file as before, and then saved it to get that result. Maybe dreamweaver is putting too much code into that line (wrong code). Which appears to be the case. What is the best way to embed the flash file. It swf with actionscript in root of site aswell. Here is the mess of code Dreamweaver CS3 outputs when importing the flash file. Anything look fishy to you guys? <script type="text/javascript"> AC_FL_RunContent( 'codebase','http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0','width','600','height','100','title','Flash Header','src','logo','quality','high','pluginspage','http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash','movie','logo' ); //end AC code </script><noscript><object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0" width="600" height="100" title="Flash Header"> <param name="movie" value="logo.swf" /> <param name="quality" value="high" /> <embed src="logo.swf" quality="high" pluginspage="http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="600" height="100"></embed> </object></noscript> Thanks again guys Id be totally lost without your guidance (and this site gets a link on front page from mine LOL) Quote Link to comment https://forums.phpfreaks.com/topic/76628-solved-php-site-help-getting-flash-banner-to-play-only-once-per-sesion/#findComment-390066 Share on other sites More sharing options...
Xtreeme Posted November 12, 2007 Author Share Posted November 12, 2007 Alright this makes it work <?php if($show_header == "no"){ echo '<img src="logo.jpg" alt="" />'; } else{ echo '<embed src="logo.swf" quality="high" pluginspage="http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="600" height="100"> </embed>'; } ?> One last question.........how do I include parameters like this? I need the no loop param for the flash. It seems to ignore it, if I just put it in before /embed This is the what Im trying to add to the embed part <param name="LOOP" value="false" /> So its 99% solved. Just that one nagging issue left, the no loop parameter. Sorry for being such a pain. My first .php site. Ive done phpbb but this is little diff, never used flash in php before. LOL. Quote Link to comment https://forums.phpfreaks.com/topic/76628-solved-php-site-help-getting-flash-banner-to-play-only-once-per-sesion/#findComment-390087 Share on other sites More sharing options...
revraz Posted November 12, 2007 Share Posted November 12, 2007 I've never used EMBED, I would only guess its either echo '<embed src="logo.swf" quality="high" pluginspage="http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="600" height="100" LOOP="false"> </embed>'; or echo '<embed src="logo.swf" quality="high" pluginspage="http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="600" height="100"> <param name="LOOP" value="false" /> </embed>'; Quote Link to comment https://forums.phpfreaks.com/topic/76628-solved-php-site-help-getting-flash-banner-to-play-only-once-per-sesion/#findComment-390097 Share on other sites More sharing options...
Xtreeme Posted November 17, 2007 Author Share Posted November 17, 2007 OK after messing a bit more with it I got some code to work. I tried what you said and no go. The last one I actually had already tried just on a guess. But this code here works great. At begining <?php session_start(); if($_SESSION['header'] == "yes"){ $show_header = "no"; } else{ $_SESSION['header'] = "yes"; } ?> where banner goes <?php if($show_header == "no"){ echo '<img src="logo.jpg" alt="flash header" />'; } else{ echo '<EMBED SRC="logo.swf" WIDTH="600" HEIGHT="100" PLAY="true" LOOP="false" QUALITY="high" MENU="false" PLUGINSPAGE="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash"> </EMBED> '; } ?> works great and no loop. I even got rid of that right click menu (play, rewind, loop, etc.) Wanted to let others know in case they have similar problem (BTW works in IE6 and Opera) Quote Link to comment https://forums.phpfreaks.com/topic/76628-solved-php-site-help-getting-flash-banner-to-play-only-once-per-sesion/#findComment-393674 Share on other sites More sharing options...
Crew-Portal Posted November 18, 2007 Share Posted November 18, 2007 to it doesnt loop open your flv and in actionscript on the last frame put stop(); This will prevent it from being played again. Hope its 100% solved now! Quote Link to comment https://forums.phpfreaks.com/topic/76628-solved-php-site-help-getting-flash-banner-to-play-only-once-per-sesion/#findComment-393677 Share on other sites More sharing options...
Xtreeme Posted November 18, 2007 Author Share Posted November 18, 2007 thanks I used that in the actionscript as you said and it saved me from having to deal with it in this new method. Well, didnt want active content warning with flash header. So.....I kicked it up a notch (Emril Lagossi voice). LOL. I used a .js file to put the flash code in. Saved that to site root following this guide http://www.adobe.com/devnet/activecontent/articles/devletter.html Then put this code at top of page <?php session_start(); if($_SESSION['header'] == "yes"){ $show_header = "no"; } else{ $_SESSION['header'] = "yes"; } ?> <script src="header.js" type="text/javascript"></script> And where I want the flash to show I used <?php if($show_header == "no"){ echo '<img src="logo.jpg" alt="flash header" />'; } else{ echo '<script type="text/javascript">Runheader();</script>'; } ?> So thanks to all who replied since theres a bit of each of your contributions in there, with a dab of adobe tutrial aswell. haha. LoL its like code soup. Dunno if its "proper" code but it does work. If you see anything wrong with it, please let me know. Quote Link to comment https://forums.phpfreaks.com/topic/76628-solved-php-site-help-getting-flash-banner-to-play-only-once-per-sesion/#findComment-394094 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.