Hi everyone, I am new to PHP and I am not understanding some of it functions and rules on how to do things. I have a few questions but I will work on one at time so that I can understand and absorb the information giving to me.

The problem that I have been having the past two days is that my flash is showing up on all my pages because I have told all my page to go to my index page which is below, because it has my navigation, header, footer, and so on.

I have tried to place my flash on a different php page but include my flash.inc.php page to the index and ofcourse I still have the same problem it shows up on all my othe pages. Is there a way to get around the problem that I am having and just maintain the flash on only the index page; but not have it on my other page that the index page are connected to.

Thanks in advance

<script language="javascript">AC_FL_RunContent = 0;</script>
<script src="AC_RunActiveContent.js" language="javascript"></script>
<link href="frontpage.css" rel="stylesheet" type="text/css" />


<?php
   include("mylibrary/login.php");
   include("mylibrary/showproducts.php");   login();
?><body>
<table width="80%" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td id="header" height="90" colspan="3">
<?php include("header.inc.php"); ?></td>
  </tr>
  <tr>
    <td id="nav" width="15%" valign="top">
<?php include("nav.inc.php"); ?></td>

    <td id="main" width="50%" valign="top">
    
 
  <script type="text/javascript">
AC_FL_RunContent( 'codebase','http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0','width','500','height','300','src','admin/images/hair','quality','high','pluginspage','http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash','movie','admin/images/hair' ); //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="500" height="300">
    <param name="movie" value="admin/images/hair.swf" />
    <param name="quality" value="high" />
    <embed src="admin/images/hair.swf" quality="high" pluginspage="http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="500" height="300"></embed>
  </object></noscript>
 
  <?php
             if (!isset($_REQUEST['content']))
                include("main.inc.php");
             else
             {
                $content = $_REQUEST['content'];
                $nextpage = $content . ".inc.php";
                include($nextpage);
             }
           ?></td>
    <td id="status" width="15%" valign="top">
  <?php include("cart.inc.php"); ?></td>
  </tr>
  
  <tr>
    <td id="footer" colspan="3">
  <div align="center">
  <?php include("footer.inc.php"); ?>
  </div></td>
  </tr>
</table>
</body>
</html>

Hi

If you are including a block of code into each page, but you only want it to show on one page, a simple fix would be to retrieve the url, explode it and find the last chunk - if it is 'index.php', then show the flash block, otherwise do not show it.

<?php
$url = $_SERVER['REQUEST_URI'];
$pieces = explode('/', $url);
$page = $pieces[sizeof($pieces) - 1];

if($page == 'index.php')
{
//FLASH CODE HERE
}

?>

Hi

If you are including a block of code into each page, but you only want it to show on one page, a simple fix would be to retrieve the url, explode it and find the last chunk - if it is 'index.php', then show the flash block, otherwise do not show it.

<?php
$url = $_SERVER['REQUEST_URI'];
$pieces = explode('/', $url);
$page = $pieces[sizeof($pieces) - 1];

if($page == 'index.php')
{
//FLASH CODE HERE
}

?>

A more efficient version of that code is as follows:

if (basename($_SERVER['PHP_SELF']) == 'index.php')
{
//FLASH CODE HERE
}

cool... i answer the question, then learn something new myself - so that basename method pulls out the file name? with externsion?

lworks

I thank everyone very much for your help, it worked. I went through many books and site to find this one problem and could not find it for nothing. I thank you so much for your time and knowledge. Now I understand and know how to do this method with php. Thank you all!!!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.