PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
I have a problem with a flash banner on top of my site that keeps reloading at every new page. So I made the page into two parts using php includes one part the header (where the flash is) and the other part into the page body. However, the flash still reloads. Any insight in how to keep the header from refreshing would be appreciated. Thanks.
<?php
$url=$_GET['url']; if (empty($url)) { $url='index'; }
changelocation($url);
function changelocation($url) {
echo '<table width="766" border="0" align="center" cellpadding="0" cellspacing="0">';
echo '<tr>';
echo '<table width="766" border="0" align="center" cellpadding="0" cellspacing="0">';
echo '<tr>';
echo '<td height="0">';
switch ($url)
{
case 'index':
include ('main.html');
break;
case 'hosting':
include ('hosting.html');
break;
case 'servers':
include ('servers.html');
break;
case 'about':
include ('about.html');
break;
case 'support':
include ('support.html');
break;
case 'membersarea':
include ('membersarea.html');
break;
}
echo '</td></tr></table>';
}
?>
Last edited by jts_01 on Sun Dec 25, 2005 5:02 pm, edited 1 time in total.
<?php
if ($_SESSION['new_user'] == true) {
// The user has seen the initial banner. Don't show it again.
SHOW BANNER
} else {
// The user hasn't seen the initial banner. Show it.
SHOW INITIAL BANNER WITH INTRO OR WHATEVER
// Set the session value so that the user doesn't see this banner view again
$_SESSION['new_user'] = 'true';
}
That might be the solution you're looking for. The only downfall is that it requires two copies of your flash banner made. You could get the flash banner to check for a PHP value but that would be slower and use up more resources.
PHP:
<?php
if ($_SESSION['new_user'] == true) {
// The user has seen the initial banner. Don't show it again.
SHOW BANNER
} else {
// The user hasn't seen the initial banner. Show it.
SHOW INITIAL BANNER WITH INTRO OR WHATEVER
// Set the session value so that the user doesn't see this banner view again
$_SESSION['new_user'] = 'true';
}
That might be the solution you're looking for. The only downfall is that it requires two copies of your flash banner made. You could get the flash banner to check for a PHP value but that would be slower and use up more resources.
Yea this more like what I'm looking for. I've created the two files but I'm kind of confused about how I should put my flash in where you say "show banner." Some example of this would really help. Thanks so far.
<?php
if ((isset($_SESSION['new_user'])) && ($_SESSION['visited'] === true)) {
// The user has seen the initial banner. Don't show it again.
?>
<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="510" height="205">
<param name="movie" value="flash/cougar1_re.swf">
<param name="quality" value="high">
<embed src="flash/cougar1_re.swf" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="510" height="205"></embed>
</object>
<?php
} else {
?>
<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="510" height="205">
<param name="movie" value="flash/cougar1_.swf">
<param name="quality" value="high">
<embed src="flash/cougar1_.swf" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="510" height="205"></embed>
</object>
<?php
// Set the session value so that the user doesn't see this banner view again
$_SESSION['new_user'] = 'true';
}
?>
Sorry to post about this so much but now I getting
Warning: session_start(): Cannot send session cookie - headers already sent by (output started at /home/trance/public_html/flashtest.php:9) in /home/trance/public_html/flashtest.php on line 128
Warning: session_start(): Cannot send session cache limiter - headers already sent (output started at /home/trance/public_html/flashtest.php:9) in /home/trance/public_html/flashtest.php on line 128
<?php
session_start();
if ((isset($_SESSION['new_user'])) && ($_SESSION['visited'] === true)) {
// The user has seen the initial banner. Don't show it again.
?>
<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="510" height="205">
<param name="movie" value="flash/cougar1_re.swf">
<param name="quality" value="high">
<embed src="flash/cougar1_re.swf" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="510" height="205"></embed>
</object>
<?php
} else {
?>
<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="510" height="205">
<param name="movie" value="flash/cougar1_.swf">
<param name="quality" value="high">
<embed src="flash/cougar1_.swf" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="510" height="205"></embed>
</object>
<?php
// Set the session value so that the user doesn't see this banner view again
$_SESSION['new_user'] = true;
}
?>
Sorry to post about this so much but now I getting
Warning: session_start(): Cannot send session cookie - headers already sent by (output started at /home/trance/public_html/flashtest.php:9) in /home/trance/public_html/flashtest.php on line 128
Warning: session_start(): Cannot send session cache limiter - headers already sent (output started at /home/trance/public_html/flashtest.php:9) in /home/trance/public_html/flashtest.php on line 128
<?php
session_start();
if ((isset($_SESSION['new_user'])) && ($_SESSION['visited'] === true)) {
// The user has seen the initial banner. Don't show it again.
?>
<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="510" height="205">
<param name="movie" value="flash/cougar1_re.swf">
<param name="quality" value="high">
<embed src="flash/cougar1_re.swf" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="510" height="205"></embed>
</object>
<?php
} else {
?>
<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="510" height="205">
<param name="movie" value="flash/cougar1_.swf">
<param name="quality" value="high">
<embed src="flash/cougar1_.swf" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="510" height="205"></embed>
</object>
<?php
// Set the session value so that the user doesn't see this banner view again
$_SESSION['new_user'] = true;
}
?>