ArticleslgStudy

science

Server Side Includes

Server Side Includes is a science topic covered in the lgStudy science library. This page brings together a partial reference excerpt, illustrations, worked examples, real-world applications and a short study plan, so you can understand Server Side Includes rather than just read about it. In short: Server Side Includes (SSI) is a simple interpreted server-side scripting language used almost exclusively for the World Wide Web. It is most useful for including the contents of one or more files into a web page on a web server (see below), using its #include directive.

Key takeaways

  • Server Side Includes belongs to science; place it in that map before memorising details.
  • Learn the definition first, then one example that makes the definition concrete.
  • Connect Server Side Includes to a quantity you can measure, compute or draw — that is where exam questions come from.
  • Reproduce the core statement of Server Side Includes from memory before moving on to harder problems.

Reference excerpt

Server Side Includes (SSI) is a simple interpreted server-side scripting language used almost exclusively for the World Wide Web. It is most useful for including the contents of one or more files into a web page on a web server (see below), using its #include directive. This could commonly be a common piece of code throughout a site, such as a page header, a page footer and a navigation menu. SSI also contains control directives for conditional features and directives for calling external programs. It is supported by Apache, LiteSpeed, nginx, IIS as well as W3C's Jigsaw. It has its roots in NCSA HTTPd. In order for a web server to recognize an SSI-enabled HTML file and therefore carry out these instructions, either the filename should end with a special extension, by default .shtml, .stm, .shtm, or, if the server is configured to allow this, set the execution bit of the file.

Design As a simple programming language, SSI supports only one type: text. Its control flow is rather simple, choice is supported, but loops are not natively supported and can only be done by recursion using include or using HTTP redirect. The simple design of the language makes it easier to learn and use than most server-side scripting languages, while complicated server-side processing is often done with one of the more feature-rich programming languages. SSI is Turing complete. SSI has a simple syntax: <!--#directive parameter=value parameter=value-->. Directives are placed in HTML comments so that if SSI is not enabled, users will not see the SSI directives on the page, unless they look at its source. Note that the syntax does not allow spaces between the leading <!-- and the directive. Apache tutorial on SSI stipulates the format requires a space character before the --> that closes the element.

Examples A web page containing a daily quotation could include the quotation by placing the following code into the file of the web page: <!--#include virtual="../quote.txt"--> With one change of the quote.txt file, all pages that include the file will display the latest daily quotation. The inclusion is not limited to files, and may also be the text output from a program, or the value of a system variable such as the current time.

Directives

Common The following are SSI directives from the times of NCSA HTTPd (the 1990s). Some implementations do not support all of them.

Control directives Control directives are later added to SSI. They include the ubiquitous if-elif-else-endif flow control and variable writing as well as more exotic features like loops only found in some implementations.

See also ESI (Edge Side Includes)

Notes

References

External links Language reference from implementations: Apache: Apache mod_include Reference. Calls directives "elements". Nginx: Module ngx_http_ssi_module. Calls directives "commands". NCSA HTTPd: Original NCSA HTTPd SSI Reference. Calls directives "commands". W3C Jigsaw: Server Side Include commands. Calls directives "elements". Highly expanded with servlets, JDBC, HTTP cookie, and loops. Tutorials: Apache SSI Tutorial Plain-English Guide to SSI SSI-Developer, Apache Server Side Includes

Worked examples

Example 1 — a first encounter with Server Side Includes

Start with the simplest possible case. Write down what Server Side Includes claims or describes in one sentence, then invent the smallest concrete situation in which that sentence is true. In science, the smallest case is usually a single object, a single equation or a single measurement. Check that every symbol or term in your sentence has a meaning in that case.

Example 2 — changing one variable

Take the situation from Example 1 and change exactly one quantity: double it, halve it, or set it to zero. Predict what should happen to Server Side Includes before you calculate. Comparing your prediction with the result is the fastest way to find out whether you understand the idea or only the words.

Example 3 — an exam-style question

Typical questions about Server Side Includes ask you to (a) state it precisely, (b) apply it to given data, and (c) explain a limitation. Practise writing all three answers in under five minutes; the third part is what separates a full-mark answer from an average one.

Applications of Server Side Includes

In research
Server Side Includes appears in science research whenever the underlying quantities have to be modelled precisely. Papers usually cite it as a starting assumption and then explore where it breaks down.
In technology and industry
Engineering practice reuses Server Side Includes in design rules, simulations and safety margins. Knowing the idea lets you read a specification sheet and understand why the numbers look the way they do.
In the classroom
Server Side Includes is common in secondary-school and first-year university syllabi. It links to neighbouring topics Scripting languages, Web 1.0, Web technology, so understanding it makes those chapters shorter.
In everyday life
Look for Server Side Includes outside the textbook — in sport, cooking, traffic, electronics or the sky above you. An example you found yourself is remembered far longer than one you were given.
Ask Teacher Smith questions about this articleOpens your AI tutor with a question about “Server Side Includes” →

How to study Server Side Includes in 20 minutes

  1. Read the reference excerpt below once, without taking notes.
  2. Close the page and write down what Server Side Includes means in your own words.
  3. Compare your version with the excerpt and mark what you missed.
  4. Work through the three examples above with pen and paper.
  5. Explain Server Side Includes out loud to somebody else — or to Teacher Smith in the lgStudy chat.

Frequently asked questions

What is Server Side Includes in simple terms?

Server Side Includes (SSI) is a simple interpreted server-side scripting language used almost exclusively for the World Wide Web. It is most useful for including the contents of one or more files into a web page on a web server (see below), using its #include directive.

Why does Server Side Includes matter?

Because it connects several science ideas at once: it gives you a definition you can apply, a quantity you can calculate, and a way to check whether a result is plausible.

How should I study Server Side Includes?

Read the excerpt, restate it from memory, then work through the examples and applications listed on this page. The five-step study plan above takes about twenty minutes.

What does this page cover?

It gives you a compact reference excerpt plus original lgStudy explanations, examples, applications and study material on Server Side Includes.

Tags

  • Scripting languages
  • Web 1.0
  • Web technology

Keep exploring