Keeping a Image only on the index page

Thread Solved

Join Date: Apr 2008
Posts: 45
Reputation: vanessia_1999 is an unknown quantity at this point 
Solved Threads: 0
vanessia_1999 vanessia_1999 is offline Offline
Light Poster

Keeping a Image only on the index page

 
0
  #1
Apr 2nd, 2009
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

  1. <script language="javascript">AC_FL_RunContent = 0;</script>
  2. <script src="AC_RunActiveContent.js" language="javascript"></script>
  3. <link href="frontpage.css" rel="stylesheet" type="text/css" />
  4.  
  5.  
  6. <?php
  7. include("mylibrary/login.php");
  8. include("mylibrary/showproducts.php"); login();
  9. ?><body>
  10. <table width="80%" border="0" align="center" cellpadding="0" cellspacing="0">
  11. <tr>
  12. <td id="header" height="90" colspan="3">
  13. <?php include("header.inc.php"); ?></td>
  14. </tr>
  15. <tr>
  16. <td id="nav" width="15%" valign="top">
  17. <?php include("nav.inc.php"); ?></td>
  18.  
  19. <td id="main" width="50%" valign="top">
  20.  
  21.  
  22. <script type="text/javascript">
  23. 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
  24. </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">
  25. <param name="movie" value="admin/images/hair.swf" />
  26. <param name="quality" value="high" />
  27. <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>
  28. </object></noscript>
  29.  
  30. <?php
  31. if (!isset($_REQUEST['content']))
  32. include("main.inc.php");
  33. else
  34. {
  35. $content = $_REQUEST['content'];
  36. $nextpage = $content . ".inc.php";
  37. include($nextpage);
  38. }
  39. ?></td>
  40. <td id="status" width="15%" valign="top">
  41. <?php include("cart.inc.php"); ?></td>
  42. </tr>
  43.  
  44. <tr>
  45. <td id="footer" colspan="3">
  46. <div align="center">
  47. <?php include("footer.inc.php"); ?>
  48. </div></td>
  49. </tr>
  50. </table>
  51. </body>
  52. </html>
Reply With Quote Quick reply to this message  
Join Date: Nov 2007
Posts: 81
Reputation: lifeworks is an unknown quantity at this point 
Solved Threads: 2
lifeworks lifeworks is offline Offline
Junior Poster in Training

Re: Keeping a Image only on the index page

 
0
  #2
Apr 2nd, 2009
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.

  1. <?php
  2. $url = $_SERVER['REQUEST_URI'];
  3. $pieces = explode('/', $url);
  4. $page = $pieces[sizeof($pieces) - 1];
  5.  
  6. if($page == 'index.php')
  7. {
  8. //FLASH CODE HERE
  9. }
  10.  
  11. ?>
Reply With Quote Quick reply to this message  
Join Date: Sep 2007
Posts: 1,449
Reputation: cwarn23 has a spectacular aura about cwarn23 has a spectacular aura about cwarn23 has a spectacular aura about 
Solved Threads: 135
cwarn23's Avatar
cwarn23 cwarn23 is offline Offline
Nearly a Posting Virtuoso

Re: Keeping a Image only on the index page

 
0
  #3
Apr 3rd, 2009
Originally Posted by lifeworks View Post
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.

  1. <?php
  2. $url = $_SERVER['REQUEST_URI'];
  3. $pieces = explode('/', $url);
  4. $page = $pieces[sizeof($pieces) - 1];
  5.  
  6. if($page == 'index.php')
  7. {
  8. //FLASH CODE HERE
  9. }
  10.  
  11. ?>
A more efficient version of that code is as follows:
  1. if (basename($_SERVER['PHP_SELF']) == 'index.php')
  2. {
  3. //FLASH CODE HERE
  4. }
Last edited by cwarn23; Apr 3rd, 2009 at 9:59 am.
Try not to bump 10 year old threads as it can be really annoying.
Like php then read my website at http://syntax.cwarn23.net/
Star-Trek-Atlantis - now that's what I call a movie ^_^
My favourite PC. - MacGyver Fan
Bad english note: dis-iz-2b4u
Reply With Quote Quick reply to this message  
Join Date: Nov 2007
Posts: 81
Reputation: lifeworks is an unknown quantity at this point 
Solved Threads: 2
lifeworks lifeworks is offline Offline
Junior Poster in Training

Re: Keeping a Image only on the index page

 
0
  #4
Apr 3rd, 2009
cool... i answer the question, then learn something new myself - so that basename method pulls out the file name? with externsion?

lworks
Reply With Quote Quick reply to this message  
Join Date: Apr 2008
Posts: 45
Reputation: vanessia_1999 is an unknown quantity at this point 
Solved Threads: 0
vanessia_1999 vanessia_1999 is offline Offline
Light Poster

Re: Keeping a Image only on the index page

 
0
  #5
Apr 3rd, 2009
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!!!
Reply With Quote Quick reply to this message  
Reply

This thread has been marked solved.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the PHP Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC