Only show the enclosed section when a certain conditions are met.

This is perhaps one of the most useful tags in Spinner. Among other things, it allows you to write HTML-code that is only showed to people with a certain client. You can for example make a table, that if viewed on a non-table-compilant client uses preformatted text, or maybe even a completely different text instead.

Conditionals

name=pattern[,pattern,...]
If the full name of the client match the pattern given, show the enclosed text.

supports=tables, images, forms, imagealign, jpeginline, backgrounds, math, java, vrml, font
If the client supports the given attribute, include the enclosed section. Note that this is configurable ([Global Variables/ Client supports regexps]). These are the defaults:

tables:Tables according to the HTML 3.0 specification
forms:Forms according to the HTML 2.0 and 3.0 specification
imagealign:The client supports align=left and align=right in images, à la Netscape.
jpeginline:The client can show jpeg images inline.
font:The client supports <font size=foo>, à la Netscape.
backgrounds:The client supports backgrounds according to the HTML3 specifications.
java:The client supports Java applets.
vrml:The client supports VRML.

prestate=state[,state ...]
Show the enclosed text, only if all the specified prestates are present. The prestates are prepended to the URL with this syntax: http://www.fop.org/(pre,state)/my/nice/page.html. See <apre></apre> for more information.

defined=define
Show the enclosed section if define is defined.

referer
Show the enclosed text, only if the referer header is supplied by the client. See <referer> for more information.

referer=pattern[,pattern,...]
Show the enclosed text, only if the referer header matches the pattern(s). See <referer> for more information.

date=yymmdd
Show the enclosed section if the date is yymmdd.

Modifiers: before, after and inclusive.

host=pattern[,pattern...]
Show the enclosed section only to hosts whose IP number matche this pattern(s).

domain=pattern[,pattern...]
Show the enclosed section only to hosts whose IP name matche these pattern(s). Notice that domainnames are resolved asynchronously. This means that the first time(s) a someone accesses this page, hostname will be the same as the ip number.

user=name[,name,...]|"any"
Show the enclosed section only to the user 'name', or, if any is specified, to any valid user on the system. Unless file=X is specified, the default user data base is used.

Modifiers: file=X, wwwfile.

Modifiers

file=X
Modifies the 'user=U' value. If this is specified, the user:password pairs will be taken from an external file of this format:
username:encrypted-password
username:encrypted-password
....

Unless wwwfile is present, it is assumed that the file 'X' is an ABSOLUTE pathname in the real filesystem, like /usr/www/security/localpasswd.

wwwfile
Assume that the file=X is a file in the virtual filesystem of the server. This might be a security problem, since everyone can read it via WWW.

before
Used together with <if date=yymmdd>. Show the enclosed section if the current date is before yymmdd.

after
Used together with <if date=yymmdd>. Show the enclosed section if the current date is after yymmdd.

inclusive
Used together with <if date=yymmdd> and before or after. Show the enclosed section if the current date is the same as or before/after yymmdd.

not
Invert the results of all tests.
and
Show the enclosed text only if all tests are true (default).
or
Show the enclosed text if one or more of the tests are true.

Patterns

* represents zero or more characters of any kind, and ? represents any (one) character.


A few Examples:

This example shows how to make part of a page available to locals only, using 'host':
  <if host="130.236.25?.*">
    <li> <a href="/local/">Local info</a>, only
    available to local clients </if>

A useful use of the 'user' option might be:

<if not user=any>
  <header name=WWW-Authenticate value="Basic; Realm=Pers">
  <return code=401>

  <h1>Access denied</h1>
  You may not see this doument without a valid user and password.
</if>
<else>
   .. The secret document ..
</else>
This will force a user entry. But please note that if the user press the 'cancel' button, or refuse to enter an authentification, the parts of the document that is outside <else></else> will be shown to him or her.