Return-Path:
In the latter part of article, we'll talk about some of the somewhat -more advanced things can be done with SSI, such as conditional statements +
In the latter part of the article, we'll talk about some of the somewhat +more advanced things that can be done with SSI, such as conditional statements in your SSI directives.
It is formatted like an HTML comment, so if you don't have SSI correctly enabled, the browser will ignore it, but it will still be visible in the HTML source. If you have SSI correctly configured, the directive will be replaced with -the results of the directive.
+its results.The element can be one of a number of things, and we'll talk some more about most of these in the next installment of this series. For now, here are some examples of what you can do with SSI
@@ -200,7 +200,7 @@Using an include file for a header and/or a footer can reduce the burden of these
updates. You just have to make one footer file, and then include it into each page
with the include
SSI command. The include
element can determine what file
-to include with either the file
attribute, or the vitrual
attribute. The file
+to include with either the file
attribute, or the virtual
attribute. The file
attribute is a file path, relative to the current directory. That means that it
cannot be an absolute file path (starting with /), nor can it contain ../ as
part of that path. The virtual
attribute is probably more useful, and should
@@ -236,7 +236,7 @@
SSI with small CGI programs. For now, here's something else that you can
do with the exec
element. You can actually have SSI execute a command using
the shell (/bin/sh
, to be precise - or the DOS shell, if you're on Win32).
-The following, for example will give you a directory listing.
<pre> <!--#exec cmd="ls" --> @@ -269,7 +269,7 @@
Setting variables
Using the
set
attribute, you can set variables for later use. We'll need this -later in the discussion, so we'll talk about this here. The syntax of this is +later in the discussion, so we'll talk about it here. The syntax of this is as follows:<!--#set var="name" value="Rich" -->@@ -296,7 +296,7 @@
Conditional expressions
Now that we have variables, and are able to set and compare their values, we -can use them to express conditionals. This lets SSI be a tiny programming languages +can use them to express conditionals. This lets SSI be a tiny programming language of sorts.
@@ -327,7 +327,7 @@mod_include
provides anif
,elif
,else
,endif
structure for building conditional statements. This allows you to effectively generate multiple logical pages out of one actual page.Not that I have anything against IE on Macs - I just struggled for a few hours last week trying to get some JavaScript working on IE on a Mac, when it was working everywhere else. The above was the interim workaround.
-Any other variable (either ones that you define, or normal enviroment variables) +
Any other variable (either ones that you define, or normal environment variables) can be used in conditional statements. With Apache's ability to set environment variables with the
SetEnvIf
directives, and other related directives, this functionality can let you do some pretty involved dynamic stuff without ever @@ -336,7 +336,7 @@
Conclusion
SSI is certainly not a replacement for CGI, or other technologies used for -generating dynamic web pages. But it is certainly a great way to add small +generating dynamic web pages. But it is a great way to add small amounts of dynamic content to pages, without doing a lot of extra work.