Sample of apicounter, datetime, and text2gif API functions

Go to Syntax Page
Go to Color Sample Page

FontNames and FontSizes:
Block1 Block1b LCD
7x11
8x12
9x13
10x14

Counter Formats:
No padding (default):
Pad with 0's (Format=%%010d):
Pad with blanks's (Format=%%10d):

Borders:
BorderWidth=1:
BorderWidth=3:

Border Indents:
BorderIndentWidth=3:
BorderIndentWidth=4:

A Border around a Border Indent:
BorderWidth=3 BorderIndentWidth=5:
BorderWidth=5 BorderIndentWidth=5:

BorderIndent=In/Out option:
BorderIndent=In (default):
BorderIndent=Out: The time is

Text2gif:
Block1, 7x11
Block1, 8x12
Block1, 9x13
Block1, 10x14
Block1b, 7x11
Block1b, 8x12
Block1b, 9x13
Block1b, 10x14
LCD, 7x11
LCD, 8x12
LCD, 9x13
LCD, 10x14
Also see Text2gif Notes below.

Datetime:
Local time, http_time format (default)
Local time, Format=It%20is%20now%20%%H:%%M:%020on%20%%m/%%d/%%y
GMT time (use option, Timebase=GMT)
Also see Datetime Notes below.

Colors:
Colors can be specified on the "FG=", "BG=", "BorderColor=", and "BorderIndentColor=" options using either a color name (black, white, red, green, and blue are currently supported), or the hexadecimal codes for the red, green, and blue values for the color (RRGGBB). See the color sample page at http:/counter2.html, or try Lem Apperson's Color Index at http://www.infi.net/wwwimages/colorindex.html.

Server-side includes and support for text-based browsers:
Server-side includes can be used to display a counter value on text-based browsers. In addition, HTML tags such as <B>, <I>, <TT>, etc. can be used to format the result. The graphics options described above (FontName, FontSize, BG, FG, border options, etc.) cannot be used. However, the Format option described above can be used to pad the result with zeros or blanks.

If your server is enabled to process server-side includes imbeded in html pages; the SSI command used in this example,
<!--#exec cgi="/cgi-bin/apicounter/icssamp1.cnt"-->, should show the value of icssamp1.cnt as follows:
Formatted using HTML tags Result
None (ie. the default font style)
Bold (<B>..</B>)
Italics (<I>..</I>)
TT (<TT>..</TT>)

Following is an example of using PRE tags (<PRE>..</PRE>) and the Format option to display icssamp1.cnt:
               Format option                Result
        --------------------------------  ----------
        No padding (default)              
        Pad with 0's (Format=%%010d)      
        Pad with blanks's (Format=%%10d)  

To support both graphics-based and text-based browsers, you might use the Alt option of the img tag. For example:
<img src="/cgi-bin/apicounter/sample.cnt?FontName=LCD" Alt="<!--#exec cgi="/cgi-bin/apicounter/sample.cnt"-->">

Note: If the examples above do not appear to display correctly, see SSI Notes below.

Error Messages:
If the file does not exist or there is an error accessing it, a message is produced on the page in place of the expected result. The error message is enclosed in a red border. For example, if you:
1.Tried to access a non-existant counter file called, "NOTexist.cnt" (say with the URL,
<img src="http://your.server.name/cgi-bin/apicounter/NOTexist.cnt">). The result might look like:
In this case, you need to ask your web administrator to create the counter file in the Counters subdirectory of the web server's root directory with an inital value in it (typically, 0), and set the file's permissions to allow the server write access.
2.Tried to access a counter file that did not contain a count (for example, was not initialized properly). The result might look like:
In this case, you need to ask your web administrator to use a text editor to initialize the counter file to the initial value you want to use (for example, 0).
3.Forgot to specify a counter file on your URL when trying to use the apicounter function (say with the URL,
<img src="http://your.server.name/cgi-bin/apicounter">). The result is:

In this case, you need to specify a valid counter file name on the URL. For example,
<img src="http://your.server.name/cgi-bin/apicounter/sample.cnt">.
4.Forgot to specify a text string on your URL when trying to use the text2gif function (say with the URL,
<img src="http://your.server.name/cgi-bin/text2gif?BG=00FFFF">). The result is:

In this case, you need to specify a text string on the Text option on the URL. For example,
<img src="http://your.server.name/cgi-bin/text2gif?Text=A%20sample%20text%20string.&BG=00FFFF">) results in:
In Japanese, the above error messages would look like:
Note: The error messages will be displayed in Japanese, as above, when the server has been started with the environment variable, LANG, set to Ja_JP.
If using server-side includes, the above error messages would look like:
Note: If the example above does not appear to display correctly, see SSI Notes below.

User Notes:
Text2gif Notes:
On the "Text=" option of the text2gif function, you need to specify the following characters by their "hex escape code":
CharacterHex Escape Code
Blank %20
" (double quote)%22
# (pound sign) %23
% (percent sign)%% or %25
Datetime Notes:
On the "Format=" option of the datetime function,
you need to specify the following characters by their "hex escape code":
CharacterHex Escape Code
Blank %20
" (double quote)%22
% (percent sign)%% or %25

and the following characters are not available:
Character
# (pound sign)

To display the Local timezone on the datetime output, you need to set the TZ environment variable. For example, for "EST" (Eastern Standard Time), you might set the TZ variable to "EST5EDT".
SSI Notes:
The examples of using the apicounter function from server-side includes on this page assume that the server has server-side includes enabled plus "imbeds on html" specified in the httpd configuration file. If the SSI examples above do not appear to display correctly, then the server is probably not configured that way. It may be that the server is configured for server-side includes in some other way (such as using them in .shtml files only). If you think this is the case, try invoking the function from a test .shtml page on your server. For example, try
<!--#exec cgi="/cgi-bin/apicounter/sample.cnt"--> in a test .shtml page. The SSI section of the online Webmaster's Guide, Using server-side includes..., describes how to configure and use server-side includes.

If you specify more than one option on the SSI tag (for example, the "Format=" option and the "TimeBase=GMT" option), you need to separate them using the hex escape code for the '&', %26. For example:
<!--#exec cgi="/cgi-bin/datetime?Format=%%H:%%M:%026Timebase=GMT"-->


BTW, you are visitor number to this page since Feb. 6, 1997.