Forum Moderators: open

Message Too Old, No Replies

Headers and Footers - using SSI

Confusion

         

sage00z

8:38 pm on May 28, 2003 (gmt 0)

10+ Year Member



Im trying to Split a table (This table is the basic format of my page) into two files and then call those files to make a seperate page (So that I will only have to change the table once and It will automatically change on all the pages that use it as a base) Is a header and a footer a good Idea for this or am I heading in the completely wrong direction. Any help would be nice (by the way I am trying to learn how to use headers and footers but every attempt has failed) Thank you :)

tedster

10:48 pm on May 28, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Welcome to the Forums, sage00z.

It sounds like you're aiming in a good general direction. It can be a big help to only update one file and have pages change across the site.

But I'm not clear if you are talking about using SSI (server side includes) or using the "includes" built into in a specific bit of WYSIWYG software, such as FrontPage. I don't use that kind of software, so I'm not sure if they have sections they call header and footer.

There is no specific HTML tag for header or footer - we just use those terms as general descriptions for parts of the page -- and WYSIWG software may do the same.

sage00z

10:50 pm on May 28, 2003 (gmt 0)

10+ Year Member



Im refering to SSI (But I am really confused on how to use it properly)

korkus2000

10:57 pm on May 28, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



just consider the header a piece you split off. With tables I try and split in a normal place like an opening <td> tag. I think its the right direction, but I always use them.

sage00z

11:03 pm on May 28, 2003 (gmt 0)

10+ Year Member



I hate to sound stupid but I really have no Idea how to do that. I have split my code but I have a few questions... My first file Is the header (header.html) Do I include the <html><head></head><body> tags? (Same goes for the foot </body></html>) And when I make my index.html (this is where Im really confused) What do I put in it

tedster

11:04 pm on May 28, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



OK - I added SSI to the title of the thread so you can attract more interstd people to the conversation. Also, we have a couple dozen threads about SSI, which you can loacate by using the Site Search function at the top of the page.

That search may answer your questions, or at least help focus them so you can come back with a more precise description of what's not working out for you. Lots of good help here, so feel free to ask more if the research doesn't do it for you.

korkus2000

11:10 pm on May 28, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



So here would be a header:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Untitled</title>
</head>
<body>
<table cellspacing="2" cellpadding="2" border="0">
<tr>
<td colspan="2">Logo and stuff for the top</td>
</tr>
<tr>
<td>
<table>
<tr>
<td><a href="#">home</a></td>
</tr>
<tr>
<td><a href="#">about</a></td>
</tr>
<tr>
<td><a href="#">contact</a></td>
</tr>
<tr>
<td><a href="#">products</a></td>
</tr>
</table>

</td>
<td>
<!-- End of Header -->

Here is a content page that calls the header and footer:

<!-- Content Below -->
<table>
<tr>
<td>All of your content</td>
</tr>
</table>
<!-- Content Above -->

Then your Footer:

<!-- Start Footer -->
</td>
</tr>
</table>
</body>
</html>

I use ASP includes. I am not sure how to call SSi includes. What ever it is it will mostlikely be a one line comment.

sage00z

12:52 am on May 29, 2003 (gmt 0)

10+ Year Member



Ok I have been searching around and reading as much on ssi as I can, but I still cant get it to work...
This is my source for the test.shtml

<HTML>
<HEAD>
<TITLE>Test</TITLE>
</HEAD>
<body bgcolor="#FFFEF5" background="images/bg.jpg">

<PRE>
<!--#include virtual="head.html"-->
</PRE>

<PRE>
<!--#include virtual="foot.html"-->
</PRE>

</BODY>
</HTML>

Is that wrong?

I also put the .htaccess file in the directory with this source

AddType text/html .htm .html .shtm .shtml .sht
AddHandler server-parsed .htm .html .shtml .sht .shtm
Options IncludesNoExec

If a site is not SSI enabled can it ever be enabled?

mivox

12:59 am on May 29, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Look at the support section for your hosting provider. Different hosts put different limitations on their customers' accounts... your host may not allow SSI, or you may have to ask them to enable that functionality for your account.

Edouard_H

1:27 am on May 29, 2003 (gmt 0)

10+ Year Member



Do you get an "error occurred processing this directive" message? If so, SSI is enabled.

You should probably also change your include files to .txt instead of .html and ensure the file path is correct and try a leading slash if the include files are in your root directory.

sage00z

1:36 am on May 29, 2003 (gmt 0)

10+ Year Member



I get no error message.
Should I try doing this using php?

Also because this is suppose to change into html format befor it reaches me... If I veiw the source and its the same as it was when I put it in, Its not working right, right?

balam

3:49 am on May 29, 2003 (gmt 0)

10+ Year Member



Not mentioned yet is the fact that your web page (NOT the header or footer includes) most likely needs to have a .shtml file extension. (At least in the Apache server world... And a DOS/Windows mentality may mean an extension of only .sht... And if that's indeed the extension your hosting provider has set for dynamic pages...) Best to ask your host if they offer SSI's and what file extension to use...

As for the include files - they can have whatever file extension you want.

My site is broken into three distinct sections. Each section has its own colour scheme (handled by separate stylesheets), but all pages have the same navigation controls at the top & bottom (header & footer).

Here's an (annotated & made-up) example of what a raw HTML page of mine looks like (that is, before it makes it to the visitor, ie. pre-includes), plus a header & footer include. Hopefully it'll help or inspire bigger & better ideas...

If I've done this right, you should be able to copy, paste & save the text in each of the following boxes into the indicated bold filenames, and things will work.

(In my setup, I have my include files in a directory called "includes". Adjust directory names below as necessary...)

index.shtml


<html>

<!-- Start off normally -->
<head>
<title>This is a demo of SSI use</title>

<!-- I don't like the default SSI error message -->
<!--#config errmsg="Oh man, something's seriously foobarred!"-->

<!-- Add page-specific meta tags -->
<meta name="description" content="This page demonstrates SSI use for headers and footers.">
<meta name="keywords" content="demo,header,footer,SSI">

<!-- Bring in the header -->
<!--#include virtual="/includes/section_a_header.inc"-->

<!-- Now for some page content -->
<h1 title="SSI Demo!">SSI Demo!</h1>

<p>&quot;Progress is great, but it's gone on far too long.&quot; - Ogden Nash</p>

<!-- Bring in the footer -->
<!--#include virtual="/includes/footer.inc"-->

section_a_header.inc


<!-- These metas go on all pages -->
<meta name="copyright" content="2003 balam">
<meta name="author" content="balam">

<!-- Other HTML HEAD stuff goes here -->
<!-- JavaScript stuff -->
<!-- CSS stuff -->
<!-- HR Pufnstuf -->

<!-- Done with HEAD, let's move on -->
</head>
<body>

<!-- I have a big table for site navigation here -->
<!-- Damned if I'm typing that in! -->

footer.inc


<!-- A small navigation bar resides here -->
<!-- Followed by copyright and contact info -->
<p>Copyright 2003 balam</p>

<!-- I'm tired, let's go home... -->
</body>
</html>

For my site and its three sections, I have 3 header includes, 1 footer and 3 stylesheets.

Ok, as I mention in the footer, I'm tired. I've added my two cents and hopefully earned five for good work...

balam

sage00z

4:37 pm on May 29, 2003 (gmt 0)

10+ Year Member



Everyone, thankyou so much (lol it turned out that my site didnt support ssi so I changed to anouther) You all have been a great help : ) thanks again