start page | rating of books | rating of authors | reviews | copyrights

CGI Programming on the World Wide Web

Previous Chapter 5
Server Side Includes
Next
 

5.8 Tailoring SSI Output

The config SSI command allows you to select the way error messages, file size information, and date and time are displayed. For example, if you use the include command to insert a non-existing file, the server will output a default error message like the following:

[an error occurred while processing this directive]

By using the config command, you can modify the default error message. If you want to set the message to "Error, contact [email protected]" you can use the following:

<!--#config errmsg="Error, contact [email protected]"-->

You can also set the file size format that the server uses when displaying information with the fsize command. For example, this command:

<!--#config sizefmt="abbrev"-->

will force the server to display the file size rounded to the nearest kilobyte (K). You can use the argument "bytes" to set the display as a byte count:

<!--#config sizefmt="bytes"-->

Here is how you can change the time format:

<!--#config timefmt="%D %r"-->
The file address.html was last modified on: <!--#flastmod file="address.html"-->.

The output will look like this:

The file address.html was last modified on: 12/23/95 07:17:39 PM

The %D format specifies that the date should be in mm/dd/yy format, while the %r format specifies "hh/mm/ss AM|PM" format. Table 5.3 lists all the data and time formats you can use.

Table 5.3: SSI Time Formats

Format

Value

Example

%a

Day of the week abbreviation

Sun

%A

Day of the week

Sunday

%b

Month name abbreviation (see %h)

Jan

%B

Month name

January

%d

Date

01 (not 1)

%D

Date as "%m/%d/%y"

06/23/95

%e

Date

1

%H

24-hour clock hour

13

%I

12-hour clock hour

01

%j

Decimal day of the year

360

%m

Month number

11

%M

Minutes

08

%p

AM | PM

AM

%r

Time as "%I:%M:%S %p"

07:17:39 PM

%S

Seconds

09

%T

24-hour time as "%H:%M:%S"

16:55:15

%U

Week of the year (also %W)

49

%w

Day of the week number

5

%y

Year of the century

95

%Y

Year

1995

%Z

Time zone

EST


Previous Home Next
Executing CGI Programs Book Index Common Errors

HTML: The Definitive Guide CGI Programming JavaScript: The Definitive Guide Programming Perl WebMaster in a Nutshell