[Top] [Prev] [Next] [Last]
|
|
Chapter 9Introduction to Content Delivery
Server-Side Imagemaps
To enable imagemap handling
- Add or uncomment this line to your httpd.conf file:
AddHandler imap-file map
- Restart the server:
# ServerRoot/bin/reload-server
Stronghold now treats all files ending in .map as imagemap files.
- the shapes of the linked regions
- the pixel coordinates (x,y) of the linked regions
- the (absolute or relative) URLs they are linked to
- the URL on which relative URLs are based
- the action to take if a user clicks an unmapped region
For any directive, there are six possible values:
For example, imagine that you want to use this image as a navigation bar:
Figure 9-1: A Navigation Bar
Figure 9-2: Coordinates on an Imagemap
The imagemap file for this image would look something like this:
base http://www.host.com/
default map
poly previous/ 14,36 66,16 66,60
rect products/ 80,18 196,46
circle help/ 245,40 270,60
rect services/ 293,18 410,46
poly next/ 425,16 425,60 478,38
With the imagemap file in place, you must link the HTML image reference to it, like this:
<a href=/maps/navigation.map><img src=navbar.gif ISMAP></a>
rect products/ 80,18 196,46 "BetaCom Products"
Content Negotiation
GET /home/ HTTP/1.1
Connection: Keep-Alive
User-Agent: Mozilla/3.0 (WinNT; I)
Host: www.host.com
Accept: text/html, text/plain, image/gif, image/jpeg, image/pjpeg ...
Accept-Encoding: compress, gzip, winzip
Accept-Language en; q=1.0, de; q=.8, fr; q=.6,
The request includes a list of acceptable media type in the Accept field, acceptable encoding types in the Accept-Encoding field, and acceptable languages in the Accept-Language field. The numbers in the Accept-Language field are q-values, and they rank the language types according to the user's preference. In this scenario, English is the preferred language, but German and French are also acceptable.
HTTP/1.1 406 Not Acceptable
Server-Side Includes
AddType text/x-server-parsed-html .shtml
Syntax and Directives
All SSI directives follow this format:
<!--#directive parameter="value"-->
echo
- Syntax: echo var="environment-variable"
- Context: HTML
Echo inserts the value of one or more SSI environment variables.
include
- Syntax: include file|virtual="path"
- Context: HTML
<!--#include file="sample.html"-->
<!--#include virtual="/virtual/sample.html"-->
fsize
- Syntax: fsize file="path"
- Context: HTML
The fsize directive inserts the size of the file specified by path, in bytes. For example:
This file is <!--#fsize file="example.ps"--> bytes.
flastmod
- Syntax: flastmod file="path"
- Context: HTML
This file was last modified on <!--#flastmod file="example.html"-->.
exec
- Syntax: exec cmd|cgi="string"
- Context: HTML
Finger C2Net's president:
<!--#exec cmd="/bin/finger sameer@c2.net"-->
This page has been accessed
<!--#exec cgi="/cgi-bin/counter.pl"--> times.
NOTE: The exec directive poses a considerable security risk, since it allows users to execute any program on the server platform. As a precaution, we recommend that you set the Options configuration directive to "IncludesNOEXEC."
config
- Syntax: config errmsg|sizefmt|timefmt="string"
- Context: HTML
You can use the config directive to modify the default SSI behavior. The parameters are as follows:
- errmsg: Sets the default error message. For example:
<!--#config errmsg="Error: Try again."-->
- sizefmt: Sets the format for file size data returned by the fsize directive. The string for this parameter is either "bytes" for file sizes in bytes, or "abbrev" for file sizes rounded to the nearest kilobyte. For example:
<!--#config sizefmt="abbrev"-->
- timefmt: Sets the format for dates and times returned by the flastmod directive and the DATE_LOCAL and DATE_GMT variables. The possible values for this parameter are as follows:
printenv
- Syntax: printenv
- Context: HTML
<!--#printenv-->
set
- Syntax: set var="variable" value="value"
- Context: HTML
This directive sets the value of an environment variable. For example:
<!--#set var="country" value="Liberia"-->
Flow Control Elements
There are four flow control elements:
<!--#if expr="test-condition"-->
<!--#elif expr="test-condition"-->
<!--#else-->
<!--#endif-->
The test-condition is one of the following:
SSI Environment Variables
In a server-side include string, you can use any environment variables available to the server, including the CGI variables listed in "CGI Error Logging" on page 10-1. SSI also has its own environment variables, listed here.
DOCUMENT_NAME
The filename of the current HTML document. For example:
This file is called <!--#echo var="DOCUMENT_NAME"-->.
DOCUMENT_URL
The URL of the current file. For example:
This document is located at <!--#echo var="DOCUMENT_URL"-->.
QUERY_STRING_UNESCAPED
An unencoded query string whose metacharacters are escaped with a backslash (\).
DATE_LOCAL
The local date and time. For example:
Here in San Francisco, it is now <!--#echo var="DATE_LOCAL"-->.
DATE_GMT
The current Greenwich Mean Time. For example:
The current time is <!--#echo var="DATE_GMT"--> GMT.
LAST_MODIFIED
The date and time when the current file was last modified. For example:
I last modified this page on <!--#echo var="LAST_MODIFIED"-->.
[Top] [Prev] [Next] [Last]
© 1998 C2Net International
Feedback: stronghold-docs@c2.net![]()