Results 1 to 9 of 9

Thread: Html server side include

  1. #1
    Join Date
    Feb 2009
    Posts
    159
    Thanks
    60
    Thanked 3 Times in 3 Posts

    Question Html server side include

    I know I have done it once berfoe and can see now that it will be the easiest way to solve my problem and for the most part it seems to work but when I view it in the browser it dose not work.

    Hear is what I am trying to do...

    I got my html doc. We will call it test_page.html for this example.

    Then I have index.html

    In the between the head tags for "index.html" I have placed the following script
    <!--#include virtual="menu.html"-->

    And when I view it in design view in dreamweaver it works but when I then view it in the browser it dose not.

    Why?
    Last edited by robin9000; 02-05-2009 at 12:45 AM.

  2. #2
    Join Date
    Oct 2008
    Location
    Sweden
    Posts
    2,023
    Thanks
    17
    Thanked 319 Times in 318 Posts
    Blog Entries
    3

    Default

    Try changing the extension from .html to .shtml, some servers require that. So rename the page to menu.shtml and then change the code to:
    Code:
    <!--#include virtual="menu.shtml"-->
    By the way, did you upload this to a server? It won't work otherwise. If you don't have a server you can install one on your computer.

    Good luck!

  3. The Following User Says Thank You to Snookerman For This Useful Post:

    robin9000 (02-02-2009)

  4. #3
    Join Date
    Feb 2009
    Posts
    159
    Thanks
    60
    Thanked 3 Times in 3 Posts

    Default

    Ok I changed it over like you said to .shtml for the menu page and made the updates that were nessary and uploaded it to the server to test it but still it did not working, maybe I am doing somthing wrong?

    The code that I have on my testpage is as follows between the two head tags:
    <head><meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>Robin's Den</title>
    <link rel="stylesheet" type="text/css" href="Scripts/jqueryslidemenu.css" />
    <!--[if lte IE 7]><style type="text/css">html .jqueryslidemenu{height: 1%;} /*Holly Hack for IE7 and below*/</style><![endif]-->
    <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.2.6/jquery.min.js"></script>
    <script type="text/javascript" src="Scripts/jqueryslidemenu.js"></script>
    <!--#include virtual="menu.shtml"-->
    <link href="Scripts/bgset.css" rel="stylesheet" type="text/css" />
    </head>


    One thing that seems wird though is the following line:
    <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.2.6/jquery.min.js"></script>

    That is not the way I have it written in my document.
    Why would it have changed?
    Last edited by robin9000; 02-03-2009 at 12:23 AM.

  5. #4
    Join Date
    Oct 2008
    Location
    Sweden
    Posts
    2,023
    Thanks
    17
    Thanked 319 Times in 318 Posts
    Blog Entries
    3

    Default

    There might be one more thing. Apparently, the file will have to be relative to the root so try this:
    Code:
    <!--#include virtual="/menu.shtml"-->
    or if it's in a folder:
    Code:
    <!--#include virtual="/folder/menu.shtml"-->
    To check if this is indeed the problem you could just specify the entire path:
    Code:
    <!--#include virtual="http://www.example.com/folder/menu.shtml"-->
    Good luck!

    Regarding the jQuery script from Google, I don't see anything wrong with it, how has it changed?

  6. The Following User Says Thank You to Snookerman For This Useful Post:

    robin9000 (02-03-2009)

  7. #5
    Join Date
    Feb 2009
    Posts
    159
    Thanks
    60
    Thanked 3 Times in 3 Posts

    Default Thank You

    Thanks I will give that a shot as soon as I can.
    and the hole googe script thing, no worrie there it was just me wondering why I had it in there, but after realizing that it was to do with my menu I did one of those o ya that's it duh!, things. LOL

  8. #6
    Join Date
    Feb 2009
    Posts
    159
    Thanks
    60
    Thanked 3 Times in 3 Posts

    Question Update.

    I have just redone things to make sure I have everything perfect and to make sure that it should work but still dose not here is a link to both the h_menu.shtml file and the "testpage.html" file. The test page is of course the file I am trying to load the .shtml file to load into.


    http://www.robinsden.890m.com/menuscripts/h_menu.shtml

    http://www.robinsden.890m.com/menuscripts/testpage.html

    As you can see every thing is in the one folder making it really a simple test.

    All I need to know is dose any one think it's my hosting company or did I do somthing wrong?

    Thanks for any help..

  9. #7
    Join Date
    Apr 2008
    Location
    So.Cal
    Posts
    3,643
    Thanks
    63
    Thanked 516 Times in 502 Posts
    Blog Entries
    5

    Default

    who's your webhost? do you know that they allow SSI? some hosts make you pay extra for that.

  10. #8
    Join Date
    Feb 2009
    Posts
    159
    Thanks
    60
    Thanked 3 Times in 3 Posts

    Talking Thanks Everyone!

    I have finnaly found a new hosting company thanks to all the great people here at dynamic drive in these forums called www.110mb.com and so now I have switched over to them.

    As for my problem I will expliane the solution now because it was through the fourum on 110mb.com that someone was able to solve it for me.

    Here is the solution to using server side includes.

    What you need to do is the file you want the data to be in you need to have the extention on that file end with .shtml not the other way around like I had it. In other words for every single file I want to use my html doc in I need to rename the extention of the file to .shtml.

    Problem sloved.

    Thanks to everyone here who posted. I know this was a tough one.

  11. #9
    Join Date
    Oct 2008
    Location
    Sweden
    Posts
    2,023
    Thanks
    17
    Thanked 319 Times in 318 Posts
    Blog Entries
    3

    Default

    Darn, I knew it was something with that shtml extension, I just got it the wrong way

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
  •