PDA

View Full Version : SSI Server Side Includes Tutorial.


entimp
06-15-2003, 11:14 PM
Intro - Pt 2 (http://www.htmlforums.com/all-around-tutorials/t-ssi-server-side-includes-tutorial-pt-2-the-ssi-25616.html) - Pt3 (http://www.htmlforums.com/all-around-tutorials/t-ssi-server-side-includes-tutorial-pt-3-the-code-for-our-example-25644.html) - Pt4 (http://www.htmlforums.com/all-around-tutorials/t-ssi-server-side-includes-tutorial-pt-4-save-the-code-30534.html) - Pt5 (http://www.htmlforums.com/all-around-tutorials/t-ssi-server-side-includes-tutorial-pt-5-yay-it-is-all-over-30535.html)

Navigation for this tutorial is now in my signiture below.

In response to a few direct requests for help regarding this issue and some that could be solved with the use of Server Side Includes I have decided to put together a basic tutorial.

Writing this is my free time at work I am going to try and break it up into two or three workable units. I will respond to comments and work on them where I see fit (don't complain about spelling though as you have a dyslexic teacher). This should make it easier for a complete novice to consume and also for me to write. I will add to this thread as an edit, unless it wont fit in the max message length.

1.0 Introduction
"Server Side Include/s" will be written in short as SSI for the rest of this tutorial.

It doesn't matter if you are a HTML pro moving on to XHTML or a complete newbie to writing pages for the internet. The uses of SSI are many fold and work wonders for dynamic or static pages. For the purposes of this tutorial I will be dealing with static pages only. If you want to progress onto dealing with SSI in dynamic pages then you will have to follow your own nose or persuade some other forum member to write a tutorial on one. This tutorial will be long enough without dealing with dynamic page content.

So what do you need? A working knowledge of HTML
How to link files through various levels of a given directory structure (ideally)
A server that will provide server side permissions. In this case ASP. I am writing this for ASP users simply as that is where my experiance resides. I am sure users of PHP will be able to pick the gist of this up and transfer the inherent contents to their choice of server side platform.To transfer this knowledge to you with some ease we are going to take a generic static web site and show how it could benefit from SSI.

We shall call this fictional website "Biology for Newbies".
Biology for Newbies is a web site that provide resources for students of... guess what... Biology. Although it can provide an awful lot of information in different content sections we are only going to give it 4 for the purposes of this tutorial.

These areas are: Famous Biologists, Biological Links, Journal Articles and Biological Photo Gallery.

The site has a typical layout. A header area for the site logo with a content area below that with navigation on the left and finally at the bottom a footer for other information.**********************************
* Header Area *
**********************************
* N * *
* A * *
* V * Content Area *
* * *
* A * *
* R * *
* E * *
* A * *
**********************************
* Footer Area *
**********************************
A link clicked in the navigation area would open in the content area. This could be done in 3 common ways. With an Iframe, a HTML frameset, or as a new HTML document with navigation, header and footer as well. The HTML might look something like this (non frame version):<html>
<head>
</head>
<body>
<table width="100%">
<tr>
<td colspan="2">Header Area</td>
</tr>
<tr>
<td width="25%">Navigation area</td>
<td width="75%">Content Area</td>
</tr>
<tr>
<td colspan="2">Footer Area</td>
</tr>
</table>
</body>
</html>This is obviously very simplified but it serves our purpose. Just pretend it has all the meta tags in there and all the content.

Frames are fine to an extent so why bother with SSI? Good question! Frames do have their problems such as search engines and dissability issues. If you want high listings in search engine results these days you have to have content. Some search engines still have issues with reading the framed content. As for writing the new content for individual HTM documents this is time consuming especially if you have to change the format of the page. If you want to give your site a new paint job it can be soul destroying in editing each individual document in your site. This is where SSI comes to your rescue.

The next step is to understand how to use an SSI and how it works.

Intro - Pt 2 (http://www.htmlforums.com/all-around-tutorials/t-ssi-server-side-includes-tutorial-pt-2-the-ssi-25616.html) - Pt3 (http://www.htmlforums.com/all-around-tutorials/t-ssi-server-side-includes-tutorial-pt-3-the-code-for-our-example-25644.html) - Pt4 (http://www.htmlforums.com/all-around-tutorials/t-ssi-server-side-includes-tutorial-pt-4-save-the-code-30534.html) - Pt5 (http://www.htmlforums.com/all-around-tutorials/t-ssi-server-side-includes-tutorial-pt-5-yay-it-is-all-over-30535.html)

Pegasus
06-15-2003, 11:38 PM
Maybe just make each section a new post, Entimp? That way people like me won't get lost quite so easily. *g*

Peg

Ravenmoonheart
06-16-2003, 09:02 AM
Oh I like this one. Is there more? This sounds like what I need.
Keep going please.
Thanks,
JS

kevin
06-16-2003, 11:10 PM
The use of SSI is not dependent on ASP or PHP or any anything like that, it just depends on if the web server is setup to parse the .shtm / .shtml pages

entimp
06-16-2003, 11:38 PM
Agreed... but it seems two of the most popular platforms for putting server side pages together are PHP and ASP. Each will have a slightly different syntax for doing the includes so I felt I needed to point it out from that point of view.

I am approaching this from a very simple angle... A way of putting a site together with some clever management of repeatable areas of markup. If anyone feels they like the taste I can only hope I have given them some kinda bug to learn a bit more about server side mechanics.

Dr. Web
06-17-2003, 12:15 PM
Originally posted by entimp
Agreed... but it seems two of the most popular platforms for putting server side pages together are PHP and ASP


Where did you get this info? I use ASP, Coldfusion, and JSP and I can't see where one is 'more popular' in using SSI than the other. Its not a matter of the language used, but the website author.

SSI isn't more popular with any language any more than dynamic web page creation. Its all a matter of author choice.

entimp
06-17-2003, 09:25 PM
Whats the deal... all it is, is a fricking tutorial... Have some time to waste at work and thoght I would do something constructive here... I have tried to help a few people with SSI here in the past and thought a better posting would be helpful to refer them to in the future. Is there a problem here or does anyone have anything else equally constructive to say.

Now if you read the post it does say "seems" and that amounts to this... from my experiance, ASP and PHP seems to be more popular.

I am writing this from my perspective and that is of ASP... I clearly noted that if anyone wanted to use this in PHP they would have to change a few things... this would be the syntax intially.

giz
07-05-2003, 05:11 PM
>> Maybe just make each section a new post, Entimp? That way people like me won't get lost quite so easily. <<

... and then link each part to the previous and next part so that having found one part it is easy to get to the other parts.



Good start to the tutorial. Yeah, do some more sometime, and soon.

chiro
03-25-2005, 12:58 PM
Good job on the tutorial, I think it will realy help those that are just starting to learn this stuff!

Ian
03-25-2005, 06:18 PM
Originally posted by chiro
Good job on the tutorial, I think it will realy help those that are just starting to learn this stuff! chiro, this thread is over 18 months old, please stop reviving old threads that are not current thanks.