htmlPX2

Home

News

User's Guide

Reference Guide

Download

Samples

Developer Info

Email

htmlPX: Reference Guide

Commands

The following commands are supported by htmlPX 1.0. Each command must begin on a separate line, and the command must be the first thing on the line.

Command Description
comments Comments in htmlPX are lines that begin with an asterisk. You cannot have comments at the end of an active line. Only entire lines can be comments.
#ECHO echo-line This command will cause the contents of the line to be written to stdout. It can be used in the .SF to give status information or error information during the generation of the website. It can be used in the template files also for debugging or status notification.
#LOAD filename This command will load the library file that is specified. The library file can contain variables, code blocks, and functions. These "objects" will become available for the following template files. The variables are defined by the #SET command, the code blocks are defined by the #DEFINE command, and the functions are defined by the #FUNCTION command. See the description of each of those commands for further information.

The files that are loaded will be used to determine whether an output file should be made when a #MAKE is encountered.

#USING filename This command will cause the specified file to be considered when determining whether to execute a #MAKE or not. If this file is newer than the output file of the #MAKE command, the #MAKE will be executed. This command would be necessary if a particular library file is not loaded before the #MAKEs begin or if an #INCLUDE file should be considered when determining whether to make an output file.
#INCLUDE filename This command will insert the file specified into the output file at this point. Variables, code blocks, and functions will be processed as normal when the file is inserted.
#SET variable-name value Used to create a variable and assign a value to that variable. The value is optional. If it is not included, the variable will have an empty string as its value.

The scoping rules for variables are simple. A variable defined in the .SF file is global and in effect throughout the generation of the website unless the #UNDEF is used. A variable defined within a template file will remain in effect throughout the processing of that template file after which time it will be automatically undeffed. Redefining an existing variable will not remove a preexisting variable from a file higher in the order, it will only temporarily replace the value. The new value will stay in effect until that variable goes out of scope.
#DEFINE code-block-name Used to define a code block in a library or template file. The code block will follow this command and will be terminated by the #END command. The code block may contain any HTML code, text, variables, other code blocks, and functions which will be processed just like it were in-line code.
#FUNCTION function-name Used to define a code block which can accept parameters. The code block can be called with the #CALL command which contains the parameters that are passed. The parameters are accessed in the code block with the variables {$1}, {$2}, and {$n} where n is the maximum number of parameters. $NP contains the number of parameters that were passed to the function by the #CALL command.

The #FUNCTION code block is ended by the #END command just like #DEFINE.

#UNDEF variable-name This command will destroy the named variable, code block, or function which will no longer be available for use.
#CALL function-name parameters This command calls a function that has previously been defined. It specifies the function name and the parameters that are being passed. The parameters are separated by the parameter delimiter which defaults to "|". The parameter delimeter can be customized with the #PARMDELIM command.
#FORALL file-name field-delimiter This command allows htmlPX to process an ASCII file that contains records. The filename that is specified is opened and each row is parsed into separate fields. The field separator is "|" by default, but can be changed as the second operand of the #FORALL command, which is optional. The code that is located between the #FORALL and its following #ENDLOOP command is processed for each record in the data file. This allows the htmlPX programmer to create table-driven HTML output.
#ENDLOOP This command ends the #FORALL loop and will return to the top of the loop until it reaches the end of the data file.
#BANNER color This command generates a banner to direct users to the htmlPX website. Since this is free software, I ask you to help advertize by directing user of your web pages to the htmlPX web page. You can set the color of the banner to WHITE, GREEN, RED, or YELLOW with YELLOW being the default. This banner is quite small and unobtrusive. Thanks for putting it in your web page.
#ENDLOOP This command ends the #FORALL loop and will return to the top of the loop until it reaches the end of the data file.
#INDIR directory-name The directory name identifies the directory where the input .HTT and .SNP files will be found. This command should be used in the .SF file if it is to be used. If it is not used, htmlPX will look in the current directory.
#OUTDIR directory-name The directory name identifies the directory where the resulting .HTML files will be placed. By default, they will go into the current directory. This command should be used in the .SF file if it is to be used.
#PARMDELIM delimiter Allows the user to specify the character that should be used as the parameter delimiter for the #CALL command parameters. By default the character is "|".
#BEGDELIM beginning-delimiter-character Specifies the beginning delimiter character for specifying a variable in a template file. By default this value is "{".
#ENDDELIM ending-delimiter-character Specifies the ending delimiter character for specifying a variable in a template file. By default this value is "}".
#MAKE template-file output-file This command is the work-horse. It identifies a template file that needs to be processed to create a resulting output HTML file.
#IF variable-name value This command provides the conditional compilation. You can check for the existence of a variable or whether the specified variable currently has the specified value. If the check is true, the enclosed code will the generated. If not true, the ELSE condition will be used. (See #ELSE and #ENDIF.)
#ELSE This command is used as would be expected for conditional compilation.
#ENDIF This command closes off the conditional compilation. It ends either the #IF or the #ELSE.
#QUIT This command will cause htmlPX to stop processing the site file or the template file at this point. All commands following the #QUIT will be ignored.
#SKIP This command will cause htmlPX to ignore the commands and text that appear between the #SKIP and the #ENDSKIP. It can be used to easily comment out sections of the code for testing.
#ENDSKIP This command causes htmlPX to begin processing once again after skipping commands and text.

Keywords

The following keywords can be used as variables to produce certain output. Currently, the keywords are all date related, but additional keywords are planned for future releases.
#CURDATE This keyword will produce the current date in the form dd-Month-yy.
#STARTDATE This keyword will produce the date the htmlPX application started in the form dd-Month-yy. It will almost always be equal to #CURDATE.
#CURYR4 This keyword will produce the current year in a four-digit format. (That makes us Y2K compliant, huh?)
#CURYR2 This keyword will produce the current year in a two-digit format. (That makes us Y2K compliant, huh?)
#CL1 - #CL7 This keyword refers to the user parameters that can be added to the command-line when htmlPX is executed.

Copyright © Keith Wilson, 1998-2001. All rights reserved.