![]() |
![]() |
|||||||||||||||||
![]() |
||||||||||||||||||
| AD: Click here to play the latest Nickelodeon game! | ||||||||||||||||||
|
What is SSI? Why not just use HTML? Well, you can answer that question real easily, if you consider this scenario, which is very plausible. Imagine you have over 20 pages in your site and that every page of yours has a navigational bar in it (much like the one on your left in this site). Now imagine if you had to update the navigational bar on every page? It can be done, but when you have 50 pages, 100 pages or 200 pages, it's just nearly impossible. Here is where SSI can help you. SSI stands for Server-Side-Includes. It's important to know that SSI is a server-side scripting language not a client-side like JavaScript or HTML. What that means is that unlike JavaScript or HTML, SSI is parsed in the server and the result is sent to browser (client-side) as normal HTML. A browser can understand HTML because it has the power to parse it. SSI, on the other hand, cannot be understood by the browser, so it must be parsed by the server and sent to the browser as HTML. This is why, if you use SSI on a site and you try to open it in your computer (unless it's a server), you'll get unexpected results. Therefore to have SSI sites, the only requirement you need is to have a SSI-enabled server. Ask your administrator if it's enabled on your server, before continuing. Ok so now you're probably wondering, how can you use SSI to reduce work, right? Well the answer is simple; through includes. Before starting of, take a look at the url for this site. It ends with a ".shtml" not ".html" or ".htm" as you may be used to (a slight caveat: This site is no longer using SSI, but instead PHP. It still however uses .shtml due to a slight trick). This is a very important thing to know, as this file extension is the only way a server can know that the file has SSI in it and parse it accordingly. Therefore you must remember to end all SSI files with a ".shtml". The code for including a file using SSI is: <!--#include file="file_name.ext" --> If you analyze it carefully you see that it starts and ends with comment tags ("<!-- and -->"). This is to make sure that if the code does accidentally gets passed to a browser than it will be ignored at show up. File_name stands for the file name to be included and .ext stands for the extension. Example. How to include a simple navigational bar. Create two pages. Name one index.shtml and the other nav.html (or .txt). In the index.shtml page, code your normal page. In the place where the nav bar would be place the above code with the file name as nav.html (or .txt). In nav.html code the navigational bar only. Do not include tages that will not be neccessary for the navigation bars. Since the browser will take the code from "nav.html" and place it where the include was called from, if you add tags like <head>, <body>, or <html> you will mess up your page. Upload both pages into your server and open up index.shtml. You should see your page with the nav bar that was coded in nav.html. Congratulations, you have included using SSI! SSI is not only useful for adding pages, but they can also, execute CGI scripts, show the date and time and much more. The breadth of SSI is to much to fit into this tutorial. |
|
|||||||||||||||||
|
The Dueling Club is an unoffical fan site and "Harry Potter",
"The Dueling Club" are reserved trademarks of JK Rowling and Time Warner. We are in no way affiliated JK Rowling, Warner Bros,
Scholastic, or Bloomsbury. All images and multimedia are copyright of their respectful owners. Please contact us for more information,
and read our Privacy Policy for full information. Layout designed and coded by the webmaster.
Copyright © 2003-2006. Duelingclub.com. All rights reserved.
|
||||||||||||||||||