DiscusWare, LLC.
Download Purchase Contact Us
Home
Support Home Documentation Knowledge Base Support Forums Support Request Advanced Services
Discus Template Language :: Special Built-In Variables

This document describes variables that are always available in all templates. Unless you hold a support contract that includes support for customization, DiscusWare does not provide support for the procedures in this section.
Support Site Search
 
Manuals and Docs
  Installation
  Upgrade
  Administration - 4.0
  Administration - 3.1
  Customization
    Skin Primer
    Skin Editing
    Interface Customization
    Templates: Variables
    Templates: Substitution
    Templates: IF-THEN
    Templates: FOREACH
    Templates: FOR
    Templates: DEFINE
    Templates: Arrays
    Templates: Skins
    Templates: Text Ops
    Templates: Subroutines
    Templates: Flow Control
    Templates: Math
    Templates: Global Options
    Templates: Colors
    Templates: Language Files

The Discus Template Language contains several built-in variables that are always available for use when a template is being interpreted. These variables can take the form of commands, arrays, hashes, and scalars. The most straightforward methods of implementing these variables are shown in these examples.

Global Options

All options.txt settings are available in the $GLOBAL_OPTIONS hash. There is a page in this documentation devoted exclusively to Global Options.

Colors

Board colors and font settings, as well as alternating colors, are available in the $colors hash and @_ALTCOLOR array, respectively. There is a page in this documentation devoted exclusively to Colors.

Browser Detection

The $browser hash analyzes the HTTP_USER_AGENT string to determine which browser is being used. This is useful in detecting a browser that does not support JavaScript or CSS so that alternate code for that browser can be presented. The following variables are set as explained (note that these are useful in IF-THEN statements but generally not displayed as textual output):

    Code Result
    $browser->{ns4} 1 if Netscape Navigator 4, 0 otherwise
    $browser->{ns6} 1 if Netscape Navigator 6, 0 otherwise
    $browser->{nsX} 1 if Netscape Navigator 4 or 6, 0 otherwise
    $browser->{ie4} 1 if Internet Explorer 4, 0 otherwise
    $browser->{ie5} 1 if Internet Explorer 5, 0 otherwise
    $browser->{ie6} 1 if Internet Explorer 6, 0 otherwise
    $browser->{ieX} 1 if Internet Explorer 4-6, 0 otherwise
    $browser->{dhtml} 1 if NN 4 or 6 or IE 4-6, 0 otherwise
    $browser->{mac} 1 if OS is Macintosh, 0 otherwise
    $browser->{mozilla} Mozilla version if Mozilla, 0 otherwise
Variables from language.conf

All discus.conf variables are available in the $L hash. The values of these variables are obtained from all language.conf files (these files for version 4.0 include language.conf, language_pro.conf, and lang40.conf). An example use follows; note that the output is not supplied here.

$L{DISCUS_PROGRAM_ERROR_MESSAGE}:
$L->{ERROR_AUTHENTICATION_WRONG_USERNAME_AND_PW}

Environmental Variables

All environmental variables are available in the $ENV hash. (We used an SSI in this documentation to fill in your information in the sample output.)

Your IP address: $ENV{REMOTE_ADDR}
Your browser: $ENV{HTTP_USER_AGENT}

Your IP address:
Your browser:

Variables from discus.conf

All discus.conf variables are available in the $DCONF hash. These variables are generally used advanced users very familiar with the Discus program. See the common.pl script and the discus.conf file for the full range of discus.conf variables available.

Your HTML URL is: $DCONF->{html_url}

Your HTML URL is: http://your.server.com/discus

Parameters

All program function parameters are available in the $PARAMS hash. These variables are generally used advanced users very familiar with the Discus program. See the common.pl script and the discus.conf file for the full range of parameters available.

Discus $PARAMS->{release}.$PARAMS->{version} was released on $PARAMS->{date}

Discus 4.00.b1 was released on 12/31/2001

Other Special Constructs and Variables

The current time of the server is available with the <#current time#> construct. The format of this time is the unix time format of seconds elapsed since January 1, 1970. At the time of this writing, the number is now over 1,000,000,000.

The number of seconds that the local time of the server differs from GMT time is available in the <#gmtoffset#> construct. This helps to determine what time zone a server is in.

The name of the script currently executing is available in the $0 variable (dollar sign followed by the number zero). The value of this variable is obtained directly from the Perl variable $0, which serves the same purpose.

Substitutions (for debugging only)

The following code allows you to access specific top-level portions of the internal template processing $substitutions variable. This is intended for debugging; well-written Perl code to supply variables to a template should not reply on the template using this construct.

$substitions->{GLOBAL_OPTIONS}

HASH(0x81016c0)


Download Purchase Contact Us
Privacy Policy
Copyright © 2005, DiscusWare, LLC, All Rights Reserved