View Full Version : Server Side Includes


chaseinchrist
08-10-2006, 06:28 PM
Hey, I've read what lissa says on this, but it really confuses me, especially the second step :

Next, make a text file (you can use Notepad). You can name the text file with the extension .txt, .html, or .shtml, it depends on what you want. The text file can include HTML, javascript, music, whatever you want to show up on a large number of pages. After you've made the text file, save it with the .txt file extension, name it anything you want.



in the first part of that step it says that I can name the text file with any extension that I want, and then in the latter part it says to save it witht he .txt extension. I've tried both, and they don't work..I don't understand....:confused:

bourdelson
08-10-2006, 08:04 PM
What she means by name it whatever you want, she's talking about the part before the extension. Your file can be something like:

yourname.txt
yourname.html
yourname.shtml

:)

justme13
08-12-2006, 06:23 AM
Yep, you can use any extension, they will all work. I typically use the .html extension so I can view my SSI page that is being applied to all my other pages(right now my site is done in PHP includes, but exactly the same concept). What are you putting in your file that isn't working? Maybe we can help you out with that! :)

chaseinchrist
08-12-2006, 02:56 PM
the thing I'm using that isn't working is my menu (which is css based). So would I create a whole html page including the css between the header tags, and make it an Html page, then link to it where I want my menu to appear?

PS* I really hope this makes sence! :)

bourdelson
08-12-2006, 04:10 PM
Here's how I usually work with includes, when first deciding what needs to be put in an include.

Code the entire first page.
Look at it and see what will appear on every page.
Break it up into pieces. Like, usually, my includes are:

01. Header, which is the beginning of the HTML document, including the opening <html> tag, the <head> tags with everything between those and the opening <body> tag, and the last line of coding in that include being my header.
02. Menu, which is just that. My navigation portion.
03. Footer. Usually, it's just the closing body and html tags.

So, my pages look like this when I'm coding in Notepad.

<!--#include file="header.html"-->
<!--#include file="menu.html"-->
all of my content goes in right here.
anything that's showing up on this particular page and this one alone goes right in here.
<!--#include file="footer.html"-->

After I've broken apart the first page, and done all of this, I just copy and paste all of the include declarations into a new document and create each page. Then, you'll upload all of your files, the includes and your pages with the included documents and ta-da! It should be working. :)

chaseinchrist
08-12-2006, 06:32 PM
<html>
<head>
<style>
ul {
list-style: none;
margin: 0;
padding: 0;
}

/* =-=-=-=-=-=-=-[Menu One]-=-=-=-=-=-=-=- */

#menu {
width: 200px;
border-style: solid solid none solid;
border-color: #94AA74;
border-size: 1px;
border-width: 1px;
margin: 10px;
}

#menu li a {
height: 32px;
voice-family: "\"}\"";
voice-family: inherit;
height: 24px;
text-decoration: none;
}

#menu li a:link, #menu li a:visited {
color: #5E7830;
display: block;
background: url(images/menu1.gif);
padding: 8px 0 0 10px;
}

#menu li a:hover {
color: #26370A;
background: url(images/menu1.gif) 0 -32px;
padding: 8px 0 0 10px;
}

#menu li a:active {
color: #26370A;
background: url(images/menu1.gif) 0 -64px;
padding: 8px 0 0 10px;
}
</style>
</head>
<body>
<div id="menu">
<ul>
<li><a href="#" title="Home">Home</a></li>
<li><a href="about.html" title="About">About</a></li>
<li><a href="ministries.html" title="Our Ministries">Our Ministries</a></li>
<li><a href="http://sacredyouthgroup.co.nr" title="Youth Group">Youth Group</a></li>
</ul>
</div>
</body>
</html>


I'm sorry for not getting it..for some reason I'm more slow today than I usually am, but the above is a copy of menu.html that I want to include on my pages...is that how I'm supposed to do it with full html tags or should I do it another way? and when I want to set it up, then I do it like below?


<html>
<head>
<title></title>
<style type="text/css">
body {
color: ;
font-family: ;
}

#menu {
position: absolute;
left: 5px;
padding: 0px;
width: 150px;
}

#content {

margin-left: 200px;
padding: 0px;
margin-right: 15px;
}
</style>
</head>
<body>
<div id="menu">
<!--#include file="menu.html" -->
</div>
<div id="content">
blah blah blah...
</div>
</body>
</html>


is that it? If it is, then that isn't working...mabye my server blocks that, I guess...oh well, if you can help, then please do!

bourdelson
08-13-2006, 06:07 PM
No, your inlcude should not be a complete html document. It should be set up a little more like this:

include:

<div id="menu">
<ul>
<li><a href="#" title="Home">Home</a></li>
<li><a href="about.html" title="About">About</a></li>
<li><a href="ministries.html" title="Our Ministries">Our Ministries</a></li>
<li><a href="http://sacredyouthgroup.co.nr" title="Youth Group">Youth Group</a></li>
</ul>
</div>


page:

<html>
<head>
<title></title>
<style type="text/css">
body {
color: ;
font-family: ;
}

#menu {
position: absolute;
left: 5px;
padding: 0px;
width: 150px;
}

#content {
margin-left: 200px;
padding: 0px;
margin-right: 15px;
}

ul {
list-style: none;
margin: 0;
padding: 0;
}

/* =-=-=-=-=-=-=-[Menu One]-=-=-=-=-=-=-=- */

#menu {
width: 200px;
border-style: solid solid none solid;
border-color: #94AA74;
border-size: 1px;
border-width: 1px;
margin: 10px;
}

#menu li a {
height: 32px;
voice-family: "\"}\"";
voice-family: inherit;
height: 24px;
text-decoration: none;
}

#menu li a:link, #menu li a:visited {
color: #5E7830;
display: block;
background: url(images/menu1.gif);
padding: 8px 0 0 10px;
}

#menu li a:hover {
color: #26370A;
background: url(images/menu1.gif) 0 -32px;
padding: 8px 0 0 10px;
}

#menu li a:active {
color: #26370A;
background: url(images/menu1.gif) 0 -64px;
padding: 8px 0 0 10px;
}
</style>
</head>
<body>
<!--#include file="menu.html" -->
<div id="content">
blah blah blah...
</div>
</body>
</html>

chaseinchrist
08-14-2006, 10:03 PM
thank you very much for your help, but for some reason it doesn't work for my server...I guess it's blocked or something like that

bourdelson
08-15-2006, 12:18 AM
You're welcome. What server are you using? Usually, if you check the FAQs of your host, it'll tell you what they support. :)

chaseinchrist
08-15-2006, 02:54 AM
I'm using the free server at 50webs.com

bourdelson
08-16-2006, 02:49 PM
Unfortunately, it looks like it is only supported by their paid hosting plans: http://forum.50webs.com/viewtopic.php?t=1671