SitePoint Sponsor

User Tag List

Results 1 to 23 of 23

Thread: Include Problem

Hybrid View

  1. #1
    SitePoint Enthusiast
    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;
    }
    
    ?>
    And this is for my html page (The HTML page works fine when it is opened by itself)

    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>
    Thanks for the help!

  2. #2
    SitePoint Addict
    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?

  3. #3
    SitePoint Enthusiast
    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...

  4. #4
    SitePoint Enthusiast
    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.

  5. #5
    SitePoint Enthusiast
    Join Date
    Apr 2005
    Posts
    67
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by k0ng
    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.
    Where does it say that? I jjust want to read about it a little bit.

  6. #6
    SitePoint Enthusiast
    Join Date
    Apr 2005
    Posts
    58
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by pbjorge12
    Where does it say that? I jjust want to read about it a little bit.
    The 6th note from the top, by Derek, on this page.

  7. #7
    SitePoint Addict
    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?

  8. #8
    SitePoint Enthusiast
    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

  9. #9
    Umm. PHP Guru....Naaaah jaswinder_rana's Avatar
    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
    ---------------------------
    Errors = Improved Programming.
    My Site

  10. #10
    SitePoint Enthusiast
    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

  11. #11
    Umm. PHP Guru....Naaaah jaswinder_rana's Avatar
    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.
    ---------------------------
    Errors = Improved Programming.
    My Site

  12. #12
    SitePoint Enthusiast
    Join Date
    Apr 2005
    Posts
    67
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by jaswinder_rana
    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.
    Yes.

    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.

  13. #13
    SitePoint Evangelist
    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.

  14. #14
    Umm. PHP Guru....Naaaah jaswinder_rana's Avatar
    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.
    ---------------------------
    Errors = Improved Programming.
    My Site

  15. #15
    SitePoint Enthusiast
    Join Date
    Apr 2005
    Posts
    67
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by jaswinder_rana
    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.
    How would I remove it? Their is somehting in their that says.

    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!

  16. #16
    Umm. PHP Guru....Naaaah jaswinder_rana's Avatar
    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'
    ---------------------------
    Errors = Improved Programming.
    My Site

  17. #17
    SitePoint Enthusiast
    Join Date
    Apr 2005
    Posts
    67
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by jaswinder_rana
    and also try removing any background color and/or images you ahave and test it on 'no-background'
    On a page with just my php navigation code and nothing else it shows up fine.

  18. #18
    Umm. PHP Guru....Naaaah jaswinder_rana's Avatar
    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.
    ---------------------------
    Errors = Improved Programming.
    My Site

  19. #19
    SitePoint Enthusiast
    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

  20. #20
    SitePoint Enthusiast
    Join Date
    Apr 2005
    Posts
    67
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Bump...I need help!

  21. #21
    SitePoint Addict
    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.

  22. #22
    SitePoint Enthusiast
    Join Date
    Apr 2005
    Posts
    67
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks so much! You rock!


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •