SitePoint Sponsor |
|
User Tag List
Results 1 to 23 of 23
Thread: Include Problem
-
May 7, 2005, 13:26 #1
- Join Date
- Apr 2005
- Posts
- 67
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Include Problem
Whenever I try to include an html page which uses remote rollovers the rollovers don't work. I am using this code for myh navigation..
Code:<?php switch ($HTTP_GET_VARS[page]) { case 'aboutus': default: include 'about.php'; break; case 'news': include 'news.php'; break; case 'orders': include 'request.htm'; break; case 'products': include 'products.html'; break; case 'copyright': include 'copyright.htm'; break; case 'privacy': include 'privacy.htm'; break; } ?>
Code:<html> <head> <title>WebsiteProductsApps</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <!-- ImageReady Preload Script (WebsiteProductsApps.psd) --> <script type="text/javascript"> <!-- function newImage(arg) { if (document.images) { rslt = new Image(); rslt.src = arg; return rslt; } } function changeImages() { if (document.images && (preloadFlag == true)) { for (var i=0; i<changeImages.arguments.length; i+=2) { document[changeImages.arguments[i]].src = changeImages.arguments[i+1]; } } } var preloadFlag = false; function preloadImages() { if (document.images) { products_10_products_Layer_2_over = newImage("appsimages/products_10-products_Layer-.gif"); products_10_products_Layer_2_copy_over = newImage("appsimages/products_10-products_Lay-13.gif"); preloadFlag = true; } } // --> </script> <!-- End Preload Script --> </head> <table id="Table_01" width="703" height="373" border="0" cellpadding="0" cellspacing="0"> <tr> <td colspan="7"> <img src="appsimages/products_01.gif" width="703" height="13" alt=""></td> </tr> <tr> <td rowspan="4"> <img src="appsimages/products_02.gif" width="10" height="359" alt=""></td> <td colspan="2"> <a href="#" onmouseover="changeImages('products_10', 'appsimages/products_10-products_Layer-.gif'); return true;" onmouseout="changeImages('products_10', 'appsimages/products_10.gif'); return true;" onmousedown="changeImages('products_10', 'appsimages/products_10-products_Layer-.gif'); return true;" onmouseup="changeImages('products_10', 'appsimages/products_10-products_Layer-.gif'); return true;"> <img src="appsimages/products_Layer-2.gif" width="83" height="26" border="0" alt=""></a></td> <td rowspan="2"> <img src="appsimages/products_04.gif" width="36" height="39" alt=""></td> <td> <a href="#" onmouseover="changeImages('products_10', 'appsimages/products_10-products_Lay-13.gif'); return true;" onmouseout="changeImages('products_10', 'appsimages/products_10.gif'); return true;" onmousedown="changeImages('products_10', 'appsimages/products_10-products_Lay-13.gif'); return true;" onmouseup="changeImages('products_10', 'appsimages/products_10-products_Lay-13.gif'); return true;"> <img src="appsimages/products_Layer-2-copy.gif" width="83" height="26" border="0" alt=""></a></td> <td colspan="2" rowspan="2"> <img src="appsimages/products_06.gif" width="491" height="39" alt=""></td> </tr> <tr> <td colspan="2"> <img src="appsimages/products_07.gif" width="83" height="13" alt=""></td> <td> <img src="appsimages/products_08.gif" width="83" height="13" alt=""></td> </tr> <tr> <td rowspan="2"> <img src="appsimages/products_09.gif" width="7" height="320" alt=""></td> <td colspan="4"> <img name="products_10" src="appsimages/products_10.gif" width="665" height="308" alt=""></td> <td rowspan="2"> <img src="appsimages/products_11.gif" width="21" height="320" alt=""></td> </tr> <tr> <td colspan="4"> <img src="appsimages/products_12.gif" width="665" height="12" alt=""></td> </tr> <tr> <td> <img src="appsimages/spacer.gif" width="10" height="1" alt=""></td> <td> <img src="appsimages/spacer.gif" width="7" height="1" alt=""></td> <td> <img src="appsimages/spacer.gif" width="76" height="1" alt=""></td> <td> <img src="appsimages/spacer.gif" width="36" height="1" alt=""></td> <td> <img src="appsimages/spacer.gif" width="83" height="1" alt=""></td> <td> <img src="appsimages/spacer.gif" width="470" height="1" alt=""></td> <td> <img src="appsimages/spacer.gif" width="21" height="1" alt=""></td> </tr> </table> <!-- End ImageReady Slices --> </body> </html>
-
May 7, 2005, 13:48 #2
- Join Date
- Oct 2004
- Location
- Southwest US
- Posts
- 203
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
I know in you php code it appears this way, but just to make sure, the html file and php file are in the same directory?
-
May 7, 2005, 13:49 #3
- Join Date
- Apr 2005
- Posts
- 67
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Yes they are.
If I test the files on my pc like H:\blah\Blah\products.html it works. But once I use my localhost/SA/index.php?page=products it stops working.
Also if I try localhost/SA/products.html it works. Pleas help...
-
May 7, 2005, 13:52 #4
- Join Date
- Oct 2004
- Location
- Southwest US
- Posts
- 203
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Sorry for all the questions, but...
Do the images appear broken, or does the rollover code not function correctly?
-
May 7, 2005, 13:53 #5
- Join Date
- Apr 2005
- Posts
- 58
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
This may not have anything to do with your question, but I noticed that you have the 'default' behaviour for your switch in the first case. This may produce wacky results (a note in the php manual suggests so anyways). It might be better to place the default at the end of the case list.
-
May 7, 2005, 13:53 #6
- Join Date
- Apr 2005
- Posts
- 67
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
No problem. The image are fine but the rollover does not work. I edited my above post a little bit so maybe you coudl reread it. Thanks
-
May 7, 2005, 13:54 #7
- Join Date
- Apr 2005
- Posts
- 67
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Originally Posted by k0ng
-
May 7, 2005, 13:56 #8
- Join Date
- Jul 2004
- Location
- canada
- Posts
- 3,193
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
try using absolute paths for images like
/appsimages/products_10-products_Layer-.gif
assuming 'appsimages' is the directory at root in public_html like
public_html
appsimages
-
May 7, 2005, 13:58 #9
- Join Date
- Apr 2005
- Posts
- 58
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Originally Posted by pbjorge12
-
May 7, 2005, 14:01 #10
- Join Date
- Apr 2005
- Posts
- 58
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Er, I seem to have mis-read the comment. The problem occurs when not breaking after a default that occurs earlier in the switch list than is standard.
-
May 7, 2005, 14:05 #11
- Join Date
- Apr 2005
- Posts
- 67
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
The images are not broken and therefore the image links are fine I believe.
Dir Structure
index.php
products.html
images
appsimages
-
May 7, 2005, 14:09 #12
- Join Date
- Jul 2004
- Location
- canada
- Posts
- 3,193
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
CAN you create a temp page and give a temporarylink toyour page
with both without and with include
i mean direct to this page and one in php via include.
just for thelength of the time till this problem is not solved.
-
May 7, 2005, 14:10 #13
- Join Date
- Sep 2004
- Location
- Oregon
- Posts
- 445
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Also; i've heard PHP5 includes don't work.
-
May 7, 2005, 14:16 #14
- Join Date
- Apr 2005
- Posts
- 67
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Originally Posted by jaswinder_rana
Here is a link to the page
http://www.phillysfun.com/sphelp/ind...?page=products
Here is the page it includes
http://www.phillysfun.com/sphelp/products.html
Also all the other pages I include work so it isn't a problem with php5
This is a mock up of a future one I am making. In the future version the images won't break the layout.
-
May 7, 2005, 14:21 #15
- Join Date
- Jul 2004
- Location
- canada
- Posts
- 3,193
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
umm, i am looking at it , but meanwhile a question, when i do viewsource of the PHP page then i see 2 <body > tags
it means you are including your page inside a <body> ta.it might be aproblem.
just take a look at it.
-
May 7, 2005, 14:28 #16
- Join Date
- Apr 2005
- Posts
- 67
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Originally Posted by jaswinder_rana
onload="preloadImages();"
How would I keep that in the page without the body tag? THanks!
If I remove the whole tag it stops functioning all together!
-
May 7, 2005, 14:29 #17
- Join Date
- Jul 2004
- Location
- canada
- Posts
- 3,193
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
and also try removing any background color and/or images you ahave and test it on 'no-background'
-
May 7, 2005, 14:36 #18
- Join Date
- Apr 2005
- Posts
- 67
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Originally Posted by jaswinder_rana
-
May 7, 2005, 14:37 #19
- Join Date
- Jul 2004
- Location
- canada
- Posts
- 3,193
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
so i think, its somehow hiding itself under the image you have on body. just a guess. might be wrong.
-
May 7, 2005, 14:42 #20
- Join Date
- Apr 2005
- Posts
- 67
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Even if I remove the bg for the entire site (gradient background and content box bg) it still won't show. Help
-
May 7, 2005, 23:10 #21
- Join Date
- Apr 2005
- Posts
- 67
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Bump...I need help!
-
May 8, 2005, 02:48 #22
- Join Date
- Apr 2005
- Location
- San Diego, CA
- Posts
- 205
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
You need to put preloadImages(); in the first body tag. I tested it and it works.
I study speed waiting. I can wait an entire hour in 10 minutes.
-
May 8, 2005, 09:02 #23
- Join Date
- Apr 2005
- Posts
- 67
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Thanks so much! You rock!
Bookmarks