"HTML Pre-Processing7

HFRD Hypertext Services - Environment Overview

| [next] [previous][contents]

5 - HTML Pre-Processing




L The HTML pre-processor is used to provide dynamic information inside of an Ootherwise static, HTML (HyperText Markup Language) document. The HTTPd server Iprovides this as internal functionality, scanning the input document for Gspecial pre-processor directives, which are replaced by dynamic 1information based upon the particular directive. 

B This concept is also known as Server Side Includes (SSI). 

I The HTML pre-processor is invoked when the document file's extension is ,.SHTML (the ``s'' may haveKoriginated from the SSI nomenclature). As there is a significant overhead Mwith pre-processed HTML compared to normal HTML, it should only be used when Fit serves a useful documentary purpose, and not just for the novelty. 

D One effective use for pre-processed HTML is the creation of single Dvirtual documents from two or more physical documents. That is, theLpre-processed document is used to include multiple physical documents, that Nmay even be independently administered, to return a composite document to the Iclient. This is a relatively low-overhead activity, but because it is a Ndynamic document loses the advantages of "If-Modified-Since:" processing (see K2 - HyperText Transport Protocol Daemon). 

Directive Syntax



M The syntax follows closely that used by the other implementations, but some Kdirectives are tailored to the VMS environment. The directive is enclosed +within an HTML comment and takes the form: E

  <!--#command [[tag="value"] ...]-->


B A directive cannot be split over multiple lines. It must Oall be contained within the one line. This restriction may be lifted in later versions.

J The command and tag keywords are case insensitive. The tag value may or Jmay not be case sensitive, depending upon the command/tag. Generally the Heffect of a command is to produce additional text to be inserted in the document. !

5.1 - Directive Commands

 

5.1.1 - ACCESSES




G The accesses directive allows the number of times the document Nhas been accessed to be included. It does this by creating a counter file in Othe same location and using the same name with a dollar symbol appended to the Ltype (extension). The count may be reset by deleting the file. This is an Lexpensive function (in terms of file system activity) and so should be used Nappropriately. It can be disabled by server configuration. Two tags provide additional functionality: 



5.1.2 - CONFIG




E The config directive allows time and file size formats to be Jspecified for all subsequent directives providing these values. Optional Mspecifications for individual directives may still be made, and override, do Jnot supercede, any specification made using a config directive. A Fconfig directive may be made once, or any number of times in a Odocument, and applies until another is made, or until the end of the document. 



5.1.3 - DIR




3 The dir directive generates an Index of C... directory listing inside an HTML document. Apart from not Hgenerating a title (it is up to the pre-processed document to title, or Notherwise caption, the listing) it provides all the functionality of the HFRD _HTTPd directory listing (see 4 - Directory Listing). It is /an HFRD HTTPd extension to pre-processed HTML. 



5.1.4 - DCL




F The dcl directive executes a DCL command and incorporates the Ooutput into the processed document. It is an HFRD HTTPd extension to the more 5common exec directive, which is also included.

J By default, output from the DCL command has all HTML-forbidden characters6(e.g. ``<'', ``&'') escaped before inclusion inMthe processed document. Thus command output cannot interfere with document Omarkup, but nor can the DCL command provide HTML markup. This behaviour may be8changed by appending the following tag to the directive:

  type="text/html"


@ Some dcl directives are for privileged documents Lonly, documents defined as those being owned by the SYSTEM account, and not Jbeing world-writeable. The reason for this should be obvious. There are Limplicit security concerns about any document being able to execute any DCL Ocommand(s), even if it is being executed in a completely unprivileged process. HHence only innocuous commands are allowed in standard documents. 



5.1.5 - ECHO




G The echo directive incorporates the specified information into the processed document. 



5.1.6 - EXEC




G The exec directive executes a DCL command and incorporates the Eoutput into the processed document. It is the VMS equivalent of the Aexec shell directive of some Unix implementations. It is Mimplemented in the same way as the #DCL directive, and so the general detail Eof that directive applies. It supports only the cmd tag, the Ecgi tag, allowing execution of CGI scripts, is not supported. 8

  <!--#exec cmd="show device/full tape1:" -->


> The exec directive is for privileged documents Lonly, documents defined as those being owned by the SYSTEM account, and not Jbeing world-writeable. The reason for this should be obvious. There are Limplicit security concerns about any document being able to execute any DCL Ocommand(s), even if it is being executed in a completely unprivileged process.  

5.1.7 - FCREATED



F The fcreated directive incorporates the creation date/time of 7a specified file/document into the processed document. 

 

5.1.8 - FLASTMOD




B The flastmod directive incorporates the last modification Ddate/time of a specified file/document into the processed document. 

 

5.1.9 - FSIZE




G The fsize directive incorporates the size, in bytes, kbytes or BMbytes, of a specified file/document into the processed document. 

 

5.1.10 - INCLUDE




G The include directive incorporates the contents of a specified +file/document into the processed document. 



I The contents of the specified file are included differently depending onJthe MIME content-type of the file. Files of text/html content-typeE(HTML documents) are included directly, and any HTML tags within themEcontribute to the markup of the document. Files of text/plain7content-type (plain-text documents) are encapsulated inA<PRE></PRE> tags and have all HTML-forbidden4characters (e.g. ``<'', ``&'') escaped beforeOinclusion in the processed document. An HTML file can be forced to be included,as plain-text by using the following syntax:F

  <!--#include virtual="example.html" type="text/plain" -->
 .

5.2 - File and Virtual Specifications




= Documents may be specified using either the FILE orVIRTUAL tags.

3 The FILE tag expects an absolute VMS filespecification.

8 The VIRTUAL tag expects an URL-style path to a9document. This can be an absolute or relative path. SeeT3.1 - Document Specification for further details. 

5.3 - Time Format



@ Note: Time formatting only applies if the HTTPd server has been compiled using DEC C. 

E Whenever a time directive is used an optional tag can be included toLspecify the format of the output. The default looks a little VMS-ish. If aJformat specification is made it must confirm to the C programming languagefunction strftime().

H The format specifier follows a similar syntax to the C standard libraryDprintf() family of functions, where conversion specifiers are>introduced by percentage symbols. Here are some example uses:<

  The date is <!--#date_local fmt="%d/%m/%y" -->.1  The time is <!--#date_local fmt="%r" -->.<  The day-of-the-week is <!--#date_local fmt="%A" -->.


L A problem with any supplied time formatting specification will be reported.

E The following table provides the general conversion specifiers. ForMfuther information on the formatting process refer to a C programming library+document on the strftime() function.!

  Specifier      Replaced byN  ---------      -------------------------------------------------------------6  a              The locale's abbreviated weekday name /  A              The locale's full weekday name 4  b              The locale's abbreviated month name -  B              The locale's full month name F  c              The locale's appropriate date and time representation J  C              The century number (the year divided by 100 and truncated=                 to an integer) as a decimal number (00 - 99) C  d              The day of the month as a decimal number (01 - 31) !  D              Same as %m/%d/%y G  e              The day of the month as a decimal number (1 - 31) in aD                 2 digit field with the leading space character fill F  Ec             The locale's alternative date and time representation C  EC             The name of the base year (period) in the locale's+                 alternative representation =  Ex             The locale's alternative date representation =  EX             The locale's alternative time representation D  Ey             The offset from the base year (%EC) in the locale's+                 alternative representation2 B  EY             The locale's full alternative year representation )  h              Same as %bc eG  H              The hour (24-hour clock) as a decimal number (00 - 23)r sG  I              The hour (12-hour clock) as a decimal number (01 - 12)   D  j              The day of the year as a decimal number (001 - 366) r8  m              The month as a decimal number (01 - 12) v9  M              The minute as a decimal number (00 - 59)E H&  n              The newline character RD  Od             The day of the month using the locale's alternative!                  numeric symbolsT HE  Oe             The date of the month using the locale's alternative                  numeric symbols kH  OH             The hour (24-hour clock) using the locale's alternative                  numeric symbols tH  OI             The hour (12-hour clock) using the locale's alternative                  numeric symbols rI  Om             The month using the locale's alternative numeric symbols  lK  OM             The minutes using the locale's alternative numeric symbolst lK  OS             The seconds using the locale's alternative numeric symbolsf  D  Ou             The weekday as a number in the locale's alternative*                 representation (Monday=1) uL  OU             The week number of the year (Sunday as the first day of theE                 week) using the locale's alternative numeric symbolst cL  OV             The week number of the year (Monday as the first day of theF                 week) as a decimal number (01 -53) using the locale'sO                 alterntative numeric symbols. If the week containing January 1oH                 has four or more days in the new year, it is consideredJ                 as week 1.  Otherwise, it is considered as week 53 of the<                 previous year, and the next week is week 1.  F  Ow             The weekday as a number (Sunday=0) using the locale's,                 alternative numeric symbols  H  OW             The week number of the year (Monday as the first day ofI                 the week) using the locale's alternative numeric symbolse aL  Oy             The year without the century using the locale's alternative                  numeric symbols dM  p              The locale's equivalent of the AM/PM designations associatedd%                 with a 12-hour clock   +  r              The time in AM/PM notatione m5  R              The time in 24-hour notation (%H:%M)l m9  S              The second as a decimal number (00 - 61)n a"  t              The tab character  $  T              The time (%H:%M:%S) tK  u              The weekday as a decimal number between 1 and 7 (Monday=1) >K  U              The week number of the year (the first Sunday as the firsts=                 day of week 1) as a decimal number (00 - 53)e aL  V              The week number of the year (Monday as the first day of theL                 week) as a decimal number (00 - 53). If the week containingG                 January 1 has four or more days in the new year, it isM                 considered as week 1. Otherwise, it is considered as week 53pC                 of the previous year, and the next week is week 1.r dA  w              The weekday as a decimal number (0 [Sunday] - 6)P  K  W              The week number of the year (the first Monday as the firstd=                 day of week 1) as a decimal number (00 - 53)i a=  x              The locale's appropriate date representationL <=  X              The locale's appropriate time representationi mG  y              The year without century as a decimal number (00 - 99)< i:  Y              The year with century as a decimal number fJ  Z              Timezone name or abbreviation. If timezone information is7                 not available, no character is output. P  %              %


l


| [next] [previous][contents]d