Log in

View Full Version : Resolved Html server side include



robin9000
02-02-2009, 09:12 PM
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?

Snookerman
02-02-2009, 09:18 PM
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:

<!--#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!

robin9000
02-02-2009, 11:46 PM
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?

Snookerman
02-03-2009, 06:44 AM
There might be one more thing. Apparently, the file will have to be relative to the root so try this:

<!--#include virtual="/menu.shtml"-->
or if it's in a folder:

<!--#include virtual="/folder/menu.shtml"-->
To check if this is indeed the problem you could just specify the entire path:

<!--#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?

robin9000
02-03-2009, 09:54 PM
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

robin9000
02-03-2009, 11:27 PM
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..

traq
02-04-2009, 11:30 PM
who's your webhost? do you know that they allow SSI? some hosts make you pay extra for that.

robin9000
02-05-2009, 12:44 AM
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.

Snookerman
02-05-2009, 12:16 PM
Darn, I knew it was something with that shtml extension, I just got it the wrong way :D