Click to See Complete Forum and Search --> : SSI shtml navigation


johndove
02-17-2010, 10:40 AM
Hi,

First, apologies if this is the incorrect category for this post (and I suspect it is but I don’t know the appropriate category to post it in, or even if there is one here).

I’m taking a first stab at an SSI navigation file, which is not working for me. The shtml file, along with the file that points to it (link1.html) is attached. In “link1.html”, the SSI code is on Line 37. I referred to two different tutorials to learn how to set this up. One provided the code:

<!--#include virtual="MLtopnav.shtml"-->

and the other tutorial said it should be:

<!--#include file="MLtopnav.shtml"-->

Also, not covered by either of the tutorials was precisely what code should be contained in the .shtml file. My assumption was, only the code that gets inserted, i.e., no body tags, header tags or anything else.

Here’s the page:

http://www.freedommd.com/Freedom10/Link1.html

It should look like this:

http://www.freedommd.com/Freedom10/MedledgerTestPage.html

This particular usage may be complicated further by the fact that this is a jquery navbar; I don’t know, but my thought was that as long as “link1.html” points to the correct nav .js files in the header tags (which it does), it should work. And our server is SSI enabled.

Can anyone tell me what I’m doing wrong?

Thanks,

John

CFHutton
02-17-2010, 12:40 PM
Hi John,

The page that has the <!-- include file="whatever.htm" --> needs to have the .shtml (depending on how the server is set up) extension, not the file you are including (unless, maybe if your included file was including files of it's own, which I've never done in the past).

The file you are including can have .htm, .html, .txt or something like those. I use .htm usually so if I open it in my text editor it gets syntax highlighting.

You put exactly what you want to include in the include file. In the case of a nav like yours, you are probably talking about a div and a list, and nothing else, depending on how you setup the nav. You wouldn't need any of the head stuff in the include (html tag, head tag, dtd...none of that most likely in this case).

If, however, you were including a footer, you might, as part of that, include the closing body and html tags.

johndove
02-17-2010, 12:53 PM
CF,

PERFECT! : )

http://www.freedommd.com/Freedom10/link1.shtml

Thank you SO much for your time and help!

John

CFHutton
02-17-2010, 12:55 PM
CF,

PERFECT! : )

http://www.freedommd.com/Freedom10/link1.shtml

Thank you SO much for your time and help!

John

Glad you got it working. :)

CFHutton
02-17-2010, 01:02 PM
One last point.

I'm not overly experienced with SSI so I don't know what 'best practices' may be for this, but in some circumstances I've found it important NOT to include things like the closing head tag. Why?

Because we have non-technical people that update pages, and many use something like Expression Web or Dreamweaver. We allow them to modify SOME styles. They can even add their own section style sheet. The way editors like those add those linked style sheets is by finding the closing head tag in the code and putting the link just above it, so if it's not there (because you are including it), then it can be a problem for some of those people.

Just something to consider depending on your situation. You can include things like a bunch of linked js/css in an include but leave the opening and closing head tags in all the pages and it gives you options you don't have if you are including the opening/closing head tags.