Jump to content

If referring page was same domain, display alternative content?


AshleyQuick

Recommended Posts

I have a flash file with an animation that's on every page. It would be ideal if the initial animation doesn't keep playing as they browse the site.

 

My thought is to create a second flash file without this animation to be displayed if their last page was the same domain.

 

Can someone assist?

Set a cookie when they come to the page. Then the flash file can read the cookie and see if it should play the animation. Or, with PHP, you can do a cookie or use session to see if they have been to a page already.

at the top of your pages, put this:

<?php
  session_start();
  $first = $_SESSION['first'] ? true : false;
  $_SESSION['first'] = true;
?>

 

then, in the page, you can use the $first variable to see if it's the first time they have been to the page:

<?php if($first){ ?>
Put animated flash code here
<?php } else { ?>
Put non-animated flash code here
<?php } ?>

Here's what I'm using, based on my research.  What do you think of this?  The others didn't seem to work even after closing the browser, restarting, clearing the cache and authenticated sessions, etc.

 

Top of pages:

<?php
$first = isset($_SESSION['first']); // Will be a boolean result
$_SESSION['first'] = true;
?>

 

placed in an include:

<?php if($first){ ?>
Animated content...
<?php } else { ?>
Non-Animated content...
<?php } ?>

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.