About site: Programming/Internet/SSI - Server Side Includes Tutorial
Return to Computers also Computers
  About site: http://www.mattkruse.com/info/ssi/

Title: Programming/Internet/SSI - Server Side Includes Tutorial A 1995 overview on Server Side Includes, their syntax and how they work, by Matt Kruse.
CRIM Computer Research Institute of Montreal. Information about the organization.

ActionCAD CAD training and consulting, publishers of the AutoCAD Basic Commands Reference Manual and other training material.

bmediagroup Specialise in services for the music industry, including development of music videos, animation, motion graphics, web sites, graphic design, film and multimedia. Based in the United Kingdom.

EiffelWorld The electronic newsletter for the Eiffel community.

QuadraMed An Electronic Document Management solution for your healthcare network that acts as a repository for downloaded and scanned documents.

Sagitta Providing high performance storage and storage area networking solutions for fibre channel, SCSI, Ultra2, SSA, RAID, digital video storage and workgroup solutions.


  Alexa statistic for http://www.mattkruse.com/info/ssi/





Get your Google PageRank






Please visit: http://www.mattkruse.com/info/ssi/


  Related sites for http://www.mattkruse.com/info/ssi/
    CyberEvidence,_Inc_ Trains computer investigators in the art of forensics data recovery and analysis of evidence relating to digital crimes.
    Self-Timed_Logic_Projects History, past and current research, publications, lectures, contacts, links.
    Proven_Solutions_Inc Located in Canada and provide consulting, customization, data conversion, installation, training and support services for Visual AccountMate financial solutions.
    Deck_Keyboards Backlit and illuminated keyboards for gaming and home use.
    Profan2 Full language with scripting/batch abilities, database development system, built-in ODBC interface, interpreter and compiler. For Windows, common in Germany, easy to make English version. English page
    OASYS-LLC Software products dedicated to the K-12 Student Services with its integrated products designed to manage children with disabilities & monitor student achievements.
    Hotwinfiles_com Shareware, freeware and demo software for download, as well as Windows software, drivers, reviews, and a software forum.
    WorkMovr__A-Frame Features a Java workflow product, WorkMovr. Read case studies, product information, and the business benefits offered.
    Bus-E_Solutions_Pty__Ltd_ Located in Australia and provide custom Java software development services specialising in e-commerce applications and integration with legacy systems.
    InfoDEN Australian based developer of PABX telephone call accounting and billing software.
    The_Fnc-2_Attribute_Grammar_System An attribute grammar system based on strongly non-circular AGs that perform extensive space optimizations
    Small_Object_Directory_Architecture An object orientated configuration directory. (PHP) [OS Independent]
    BenQ Manufacturer of P30 smartphone, based on UIQ platform. Includes technical and feature information and an interactive demo (which requires Flash to run).
    Steadfast_Suggestions_for_Web_Design A dozen suggestions and principles for basic web design and site architecture.
    Cool_Utils Software to simplify the work with different files. Covering converting images, managing hard dick space, CD burning, print or export files to various formats, file comparison/merging and folder synch
    NetServiceBooks Web based program for HVAC, plumbing, electrical or service companies. Provides functions like online scheduling, dispatching, job cost, purchasing, billing, accounts receivable and payable.
    phpCipher Online PHP encoder with client management and licensing system. Knowledge base includes online support, user manual, sample code, and a demonstration of use. [Free for personal/non-commercial]
    DALnet Offers full services. Administration, e-zine, help documentation, and users section.
    NVisage Design, e-commerce, content management, database development, and search engine optimization, Located in Brighton, United Kingdom.
    Ping_Plotter A Windows 98/NT program for monitoring network latency.
This is websites2007.org cache of m/ as retrieved on 2008.10.11 websites2007.org's cache is the snapshot that we took of the page as we crawled the web. The page may have changed since that time.
Server Side Includes TutorialSERVER SIDE INCLUDES Powered by Clarynx TechnologiesClick here to listen to this story Please rate this article!Article Rating: --10987654321( 10 = Best )Please rate this article at cgi-resources.comso it can be ranked in their system and others can find it.Take advantage ofSSI's to createdynamic web pages!Contents:1. Client-Server Basics2. Document Parsing3. SSI Format4. Executing the Command5. Writing the Program6. Can I start Using Them?7. How do I enable them?8. A perfect use9. ConclusionAuthor's Note: This article was written in 1995, so technical specifics may be out of date. However, the concepts still stand and I think this is a good introduction to what SSI's are and how/why they work.For more information on SSI's, please the CGI Resources List of articles to continue your learning.If you've ever seen a counter on someone's page that says "You arevisitor #1000" or a greeting that says "Welcome, visitor fromyoursite.com", you have seen server-side-includes at work. They can bevery useful for a number of different things, and if you've foundyourself wanting to learn more about how to do "cool things" on yourweb pages, this might be your next step.CLIENT -SERVER BASICS Before teaching you how to do these tricks, let's first make sure youhave a basic understanding of how documents are loaded. Let's say auser from somewhere in the world wants to load your page into theirWWW browser. They type in the address, and that sends a request outto the machine where your page is stored. On this machine, there is aspecial program constantly running and looking for incoming requests.The request from the person wanting your page gets sent to thisprogram, and it is its job to go get the page from the computer,package it up the correct way, and ship out the data to the person whois wanting it. The program requesting the document (Netscape, Mosaic,Lynx, etc) is called the client. The program that takes the requestand returns the page is called the server. The important thing toremember is that the server is always running, and it is what does thework to return the page that is requested.There are many different servers available for many types ofcomputers, and they are all a little different. So getting things towork correctly with one server may not work with another, and someservers can do things other servers can't. But most servers (that Iknow of) are able to do server-side-includes.DOCUMENT PARSING Now comes the important part. Most servers are not just limited tograbbing a home page from the disk and sending it back, though. Theycan do other nifty tricks before sending the results back to theclient requesting it.One of these things is searching through the page it is returning forspecial commands that it recognizes. This is called "parsing" thedocument. In order for the server to do this, it must be told to doso. By default, most servers do not parse a document before sendingit.If your site gets a lot of accesses to their pages, your server has alot of work to do. It has to manage all of the incoming requests, findthe files, and return them to the right places. This can take a lot ofcomputing power. Now, imagine if the server had to first look throughevery single document for commands before it sends it - even if most ofthem do not contain any commands at all. This will just put even moreload on the server, and it may not be necessary. So there is a methodused to tell the server which documents it should parse for commandsand which documents it can safely ignore.The way it decides on this is by the filename of the document it isgoing to send. Most WWW pages end in .html, which lets the server knowit is just an HTML document. Most servers will not look at these forcommands. Instead, if you want your document to be parsed, you need togive it an extension of .shtml. When the server is going to send anydocument that ends with .shtml, it knows that is has to check forhidden commands first.You can usually set things up the way you want it, though. So, the WWWadministrator decides on what fileames wll be parsed and which oneswill not. On our system, I have enabled parsing on ALL documents thatend in .html, so there is no need to use .shtml. This can slow theserver down considerably, but if the machine is fast enough and is notoverhwelmed, the performance will not suffer.So now you know that the server can check for commands. But what doesit look for? And what does it do when it finds a command?SSI FORMAT The commands that the server looks for are actually kept inside ofcomment lines. A comment line in an HTML document looks like this:<!--This is a comment-->The '<!--' and '-->' are what contains the comment. This will not bedisplayed by the browser that is viewing the page.By using a special format inside of the comment, the server willrecognize it as a command, rather than just something to skip over andignore. A server-side-include looks something like this:<!--#exec cgi="filename.cgi"-->The important part is the '#' at the beginning of the comment, whichtells the server that this is a command. This is followed by thekeyword 'exec', which is a command telling the server to execute thefollowing program. The cgi="filename.cgi" portion tells the serverexactly which program to execute. #exec is just one of a few possiblecommands, which will be covered below. For now, we'll use this formatas a specific example.EXECUTING THE COMMAND In the example above, "filename.cgi" is given as the name of theprogram to execute. So, the server executes this prorgamautomatically and waits for it to finish.Anything printed to the output by the program replaces theserver-side-include command in the document. So, if you have acommand like:<!--#exec cgi="filename.cgi"-->in your document, and filename.cgi saidprint "hello"the output "hello" would be sent back to the server and it would insertit into the document in place of the command. So anyone viewing thesource code to your page would simply see "hello" and not even beaware that it was the output of an external program. This is thewhole idea behind SSI's - inserting something into the documentautomatically every time it is loaded.WRITING THE PROGRAM Now that you have the correct format for executing a command, all youneed is a program to run. If you aren't a programmer at all, you mighthave a lot of difficulty at this point because things like this justare not that simple. But I'll try to explain the basics.Programs can be written in any language, as long as they can run on themachine you are using. This means C, C++, Pascal, Shell scripts,fortran, or any other language. The most commonly-used language forthese purposes is Perl. Perl is probably the fastest, easiest way toaccomplish tasks that you want without having to go to great lengthsjust to do it. It is available for many systems (mainly unix, butother Operating Systems have ports available) and you'll be able tofind many scripts written in Perl to do what you want. But going intodetail about Perl is beyond the scope of this page.Here is a basic perl script that will execute and return "Hello":#!/usr/bin/perlprint "Content-type: text/html\n\n";print "Hello";Wait...if the only thing this prints is "Hello", then why is itprinting that "Content-type" line too? The answer is simple, and oftenforgotten by people new to programming like this.The line that reads "Content-type: text/html\n\n" is printed first sothat the server knows what kind of data is coming back from thescript. When you use a SSI, the server has no idea what is goin to bereturned by the script and inserted into the document. It can be plaintext, HTML, a gif image, a jg image, etc. So every script must startwith a line telling the server what is being returned so it knows how tointerpret it correctly. So the complete output of the above script isthis:Content-type: text/htmlHelloNotice the empty line between the Content-type line and the data thatis to be returned. This is REQUIRED in order for the line to beunderstood. Also, the Content-type in this case (and in most cases) istext/html, which means the returned data is just text, and it mightcontain some HTML tags like <B>, <I>, etc.<P>What are all the Available Commands?I'm not going to duplicate all of the possible calls here, because theydiffer slightly depending on what server youi are running, and becausethere are other places that already do that. Check out NCSA'ssite for more information.CAN I START USING THEM? It's not quite that easy (but what is? :). Since server setups differfor different machines and sites. Some things to keep in mind:Not all sites have SSI's enabled at all. You'll have to mail your sysadmin to see if you can use them.Some sites do not allow scripts do be executed in user's home directories. This means that you cannot do any of this simply. Ask your sysadmin, once again.Some sites have #exec disabled, but not other SSI's.Some sites do not have Perl installed on their system.If all else fails, mail your system administrator. Ask if SSI's are enabled, whether you can have scripts in your own directory, whether you can have access to the /cgi-bin directory (where most scripts are stored), whether you have perl or not, etc. If he does not know how to fix these things, tell him that a REAL sysadmin would know how. Blackmail him to keep his dirty secret private.HOW DO I ENABLE THEM? I can only speak for the NCSA httpd server, since that is what I haveexperience with. there is one file that controls this access -srm.conf. Usually it is located in/usr/local/etc/httpd/conf/srm.conf. If you are curious, you can evenlook at it yourself to see. At the bottom of the file, there are theselines:# ScriptAliased directories, uncomment the following lines.#AddType text/x-server-parsed-html .shtml#AddType application/x-httpd-cgi .cgiThese control the things we have been talking about. The first linesays what filenames should be parsed - .shtml by default. The secondline tells the server which files are programs or scripts to execute.By default it is .cgi, so any program you write to use will need toend in .cgi or it won't be recognized as a program.In order to enable both of these things (which is probably what youwant), get rid of the "#" in the front, which tels the server to ignorethe lines. Then, you'll have to restart the httpd server in order forit to re-read the configuration files and do what you want. This isaccomplished by the following command:kill -HUP ## is the process ID of the httpd server running right now. To find outwhat the PID is, you can do two things:1. do a 'ps -ax' and see what it says.2. look in /usr/local/etc/httpd/logs/httpd.pidA PERFECT USE Another command available in SSI's is #include, as opposed to #exec.This command does not execute a program that you must write - instead,it just inserts a file into your WWW page. I find this to be one ofthe most valuable parts of SSI's. If you've browsed any of my pages,you'll notice that most of them have the same exact footer at thebottom. To type each one in separately would take a long time. Plus,when I want to change something I would have to change every singlepage. So instead, I use an #include statement to insert a separatefooter file that I have created.This way, I can change the one footer file and be done. Each time apage is loaded, the server will go out and insert the footer for me,making it look like I just typed it in on all of them. See thereference above for the syntax on this command, as well as the others.CONCLUSIONHopefully you now have a good understanding of how SSI's work, how touse them, and how to enable them on your server. Now the real work isahead of you - either finding the scripts you want to use or writingthem on your own.As is so often the case, the things you see on pages that make you say"Cool!" are also the complicated things. It's ridiculous to think thatyou can learn to create these great things in a week or so, so don'texpect to.I've created some interesting applications for my site, I think. ButI've been programming different things for many years. I've been usingunix since '92, including some system administrating. I've been usingthe WWW since '93. I started with CGI and Perl shortly after that.This is by no means asimple, quick process, and the absolute best thing you can remember isthat the most difficult and time-consuming things to learn are also themost rewarding :)Good luck!! This is my experiment with (purely voluntary) Micro-Payments. Basically, web users make very small cash contributions to the sites they find most useful. If many people do this, the web site operators can be rewarded without having to resort to banner ads, etc. This link will take you to PayPal where you can donate $2 to support my site (please... no need to donate more than once). This is purely voluntary and is in no way a "fee" for the information I put on my site. Thanks.I write these articles to help people. Please let me know how I'm doing!What did you think of this page?Please rate it and drop me a quick anonymous note.RATINGVery usefulSomewhat usefulMaybe a little usefulNot at all usefulPlease leave a quick comment and let me know your thoughts. All honest comments are appreciated!Copyright 1995, Matt Kruse <matt@mattkruse.com>This document may not be reproduced in any way without the permission of the author
 

A

1995

overview

on

Server

Side

Includes,

their

syntax

and

how

they

work,

by

Matt

Kruse.

http://www.mattkruse.com/info/ssi/

Server Side Includes Tutorial 2008 October

dvd rental

dvd


A 1995 overview on Server Side Includes, their syntax and how they work, by Matt Kruse.

Rules




© 2008 Internet Explorer 5+ or Netscape 6+

Recommended Sites: 1. Arts - Business - Computers - Games - Health - Home - Kids and Teens - News - Recreation - Reference - Regional - Science - Shopping - Society - Sports - World Miss Gallery - Top Anime Hentai - DVD rental by mail - Credit Cards - Free Ringtones - Credit Card - Debt Consolidation - Music Festival
2008-10-11 08:31:49

Copyright 2005, 2006 by Webmaster
Websites is cool :) 75Hotel Berlin - Krakow Hotels - Hosting - Caravans - Kraków Noclegi