|
|
| |
eXtended SSIs
Extender SSIs add three additional pragmas to SSIs.
printenv
| |
|
|
| |
which just dumps out the envrionment. Note: Apache 1.2 or better.
| |
HTTP_REFERER=http://localhost/jlk/apache/include_ssi.shtml
HTTP_CONNECTION=Keep-Alive
HTTP_USER_AGENT=Mozilla/4.0 [en] (WinNT; I)
HTTP_PRAGMA=no-cache
HTTP_HOST=localhost
HTTP_ACCEPT=image/gif,image/x-xbitmap, image/jpeg, image/pjpeg, */*
HTTP_ACCEPT_LANGUAGE=en
HTTP_ACCEPT_CHARSET=iso-8859-1,*,utf-8 SystemRoot=C:\WINNT
COMSPEC=C:\WINNT\system32\cmd.exe
WINDIR=C:\WINNT
PATH=C:\Perl\bin;c:\mks\mksnt;c:\winnt\system32;
c:\winnt;c:\Netscape\server\plugins\dynamo;
SERVER_SOFTWARE=Apache/1.3b3
SERVER_NAME=jaunty
SERVER_PORT=80
REMOTE_HOST=127.0.0.1
REMOTE_ADDR=127.0.0.1
DOCUMENT_ROOT=c:/apache/htdocs
SERVER_ADMIN=jkissel@sybase.com
SCRIPT_FILENAME=c:/apache/htdocs/jlk/apache/xssi.shtml
REMOTE_PORT=3586
GATEWAY_INTERFACE=CGI/1.1 SERVER_PROTOCOL=HTTP/1.0
REQUEST_METHOD=GET
QUERY_STRING=
REQUEST_URI=/jlk/apache/xssi.shtml
SCRIPT_NAME=/jlk/apache/xssi.shtml
DATE_LOCAL=Thursday, 16-Apr-1998 11:43:58
British Summer Time DATE_GMT=Thursday, 16-Apr-1998 10:43:58 GMT
LAST_MODIFIED=Thursday, 16-Apr-1998 11:43:56 British Summer Time
DOCUMENT_URI=/jlk/apache/xssi.shtml
DOCUMENT_PATH_INFO=
DOCUMENT_NAME=xssi.shtml Title=eXtended SSI
|
|
| |
which you may or may not find interesting. But more importantly, XSSIs include
conditional html.
Let me repeat that.
XSSIs provide conditional html!
Yes, you can detect whether I'm using Netscape or IE4 and display a different
page for each of them without writing cgi scripts, JavaScripts or Jscripts,
JavaApplets or ActiveX controls.
Now a message from the author
Please Don't!
Anyone who slaps a "this page is best viewed with Browser X" label
on a Web page appears to be yearning for the bad old days, before the
Web, when you had very little chance of reading a document written on
another computer, another word processor, or another network.
[Tim Berners-Lee in Technology Review, July 1996]
So much for you taking notice of my opinions. How do we do this conditional html?
Flow Control Elements
| |
<!--#if expr="test_condition" -->
<!--#elif expr="test_condition" -->
<!--#else -->
<!--#endif -->
|
|
| |
where test_condition is
| |
string true if string is not empty
string1 = string2
string1 != string2
string1 < string2
string1 >= string2
string1 < string2
string1 >= string2
Compare string1 with string 2.
If string2 has the form /string/ then it is compared
as a regular expression. Regular expressions have the
same syntax as those found in the Unix egrep command.
( test_condition )
true if test_condition is true
! test_condition
true if test_condition is false
test_condition1 && test_condition2
true if both test_condition1 and test_condition2 are true
test_condition1 || test_condition2
true if either test_condition1 or test_condition2 is true
|
|
| |
and finally you can set your own variables!.
set
| |
<!--#set var="Title" value="Apache RTFM!" -->
|
|
| |
Which bring be to a complete example, namely the Apache RTFM standard template.
| |
<!--#set var="Title" value="Your Title Goes Here" -->
<!--#include file="rtfm_header.shtml" -->
<!--#include file="you new html file.html" -->
<!-- set, delete, or modify as required -->
<!--#set var="Previous" value="<a href=\"????.shtml\">Previous file</a>" -->
<!--#set var="Next" value="<a href=\"????.shtml\">Next File</a>" -->
<!--#include file="rtfm_footer.shtml" -->
|
|
| |
The rtfm_header.shtml looks like
| |
<html>
<head>
<title>
<!--#echo var="Title"-->
</title>
.
.
|
|
| |
and the rtfm_footer.shtml
| |
<center>
<hr width=50%>
<!--#if expr="\"$Previous\" != \"\" " -->
<!--#echo var="Previous" -->
<!--#endif -->
<a href="rtfm.shtml">RTFM Index</a>
<!--#if expr="\"$Next\" != \"\" " -->
<!--#echo var="Next" -->
<!--#endif -->
<hr width=50%>
<!--#config timefmt="%A %B %d %Y"-->
<h6>
<a href="/misc/copyright.html">Copyright</a> ©
1998 Open Source Migrations ltd. All Rights Reserved.<br>
Apache RTFM last updated <!--#flastmod virtual="rtfm.shtml"-->
</h6>
</center>
</body></html>
|
|
| |
So what's it all do?
First we get the title of each document printed.
We set the title for each document in the template file.
| |
<!--#set var="Title" value="eXtended SSI" -->
<!--#include file="rtfm_header.shtml" -->
|
|
| |
And in the rtfm_header.shtml file
| |
<html>
<head>
<title>
<!--#echo var="Title"-->
</title>
|
|
| |
Prints it out the doucment title in the correct context.
Next we use want to create a mini-navigation
menu in the footer. The lines
| |
<!--#set var="Previous" value="<a href=\"include_ssi.shtml\">
Including files with SSIs</a>" -->
|
|
| |
In the template file set up the footer information so we can point at the
previous document in this section.
The footer file then conditionally displays the parts of the menu we have
setup in the template.
| |
<!--#if expr="\"$Previous\" != \"\" " -->
<!--#echo var="Previous" -->
<!--#endif -->
|
|
| |
In the footer we check to see of $Previous is not equal to "" (an empty string)
If this is TRUE, the footer prints out a link to the previous section. The same
type of test is used for creating a link to the Next
section.
The pragma expr="....." must contain "'s, but there might be spaces
in the string $Previous so we enclose in in quotes, but since there are
already inside a set of quotes (expr="...."), we need to "escape" these
inner quotes.
| |
String1
\"$Previous\" and String2
\"\"
|
|
| |
Just for fun
|
|