story97 Posted October 18, 2006 Share Posted October 18, 2006 Hello,I'm a designer, not a coder, but I'm in need of a little help.The site i'm working on now has a flash header and menu. This can be a problem for people with Active-X turned off. So I want to offer an option.Load the site using the flash. Right under the menu, have a link "Non flash site". Now, by itself this might be simple. but again, i'm not a programmer. I'd like this setting stored in a persistent cookie so the user only has to see things they don't want to once.Is this too broad of a question? Quote Link to comment Share on other sites More sharing options...
printf Posted October 18, 2006 Share Posted October 18, 2006 No, it's not broad question...On your page, check if the cookie is present, if it is set, then show output based on the cookie value. If it's not set, add your link [b]Non flash site[/b] that point back to that page and set the cookie, and then show the page where non flash content is shown!example... (change .domain.com) to (.your_domain.com)[code]<?php// page// show flash, default$type = 1;/* first check if we have display change request */if ( isset ( $_GET['display'] ) ){ $test = intval ( $_GET['display'] ); if ( $test == 0 || $test == 1 ) { // valid change request $type = $test; } setcookie ( 'non_flash', $type, ( time () + 60*60*24*365 ), '/', '.domain.com' );}/* else if cookie is set */else if ( isset ( $_COOKIE['non_flash'] ) ){ $test = intval ( $_COOKIE['non_flash'] ); if ( $test == 0 || $test == 1 ) { // valid cookie value $type = $test; } else { // cookie set, but not a valid cookie value, so reset the default setcookie ( 'non_flash', $type, ( time () + 60*60*24*365 ), '/', '.domain.com' ); }}else{ // no cookie set, so set it! setcookie ( 'non_flash', $type, ( time () + 60*60*24*365 ), '/', '.domain.com' );}// now show your page based on $typeif ( $type == 1 ){ // flash content echo "<div align='center'>This is a flash filled page<br /><br />Show <a href='/index.php?display=0'>non flash</a> page always!</div>";}else{ // non flash content echo "<div align='center'>This is a page with no flash<br /><br />Show <a href='/index.php?display=1'>flash</a> page always!</div>";}?>[/code]me! Quote Link to comment Share on other sites More sharing options...
story97 Posted October 18, 2006 Author Share Posted October 18, 2006 Wow fantastic.I'm remote right now But I'll give this a shot in a couple hours. I REALLY appreciate it. Quote Link to comment Share on other sites More sharing options...
story97 Posted October 18, 2006 Author Share Posted October 18, 2006 Nevermind I copied and pasted the code to my PDA then to the site.This is exactly what I wanted. Thank you so much! Quote Link to comment 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.