Solutions : Page Generators : RTPG
RTPG
Description
RTPG (Real-time Page Generator) dynamically generates web pages each time they're accessed picking up the most current updates to both templates and data. RTPG supports programmatic logic within its template markup syntax offering conditional processing in addition to calculations and other functions. See USAGE for detailed information about RTPG.
Input Parameter Driven
Processing is based on the input parameters passed on invocation. Input parameters supported include optional specification of templates, data directories and configuration files.
Template Markup
RTPG supports programmatic conditional logic syntax in its template markup syntax. Template markup supports conditional data groups generation, conditional repeating groups, conditional nesting of data groups, and calculated data by data item reference.
RTPG requires some programming expertise on the part of the webmaster.
RTPG has no restriction as to the number of templates supported. Templates are easily edited using any standard ASCII text editor or HTML authoring tool.
Data Formats
RTPG supports standard ASCII CSV or TAB delimited datasets/files.
Configuration Options
External configuration files provides simplified installation and maintenance. Support of multiple configuration files provides enhanced reuse with expanded invocation options.
Web Server Requirements:
- Operating Systems Supported: Unix, Linux, Macintosh OS X® and Windows®
- HTTP 1.x with CGI (Common Gateway Interface) PERL 5.x (check with your ISP or Server Administrator; this requirement is typically supported on most systems)
- Optional: SENDMAIL (supported on most all Unix/Linux platforms), or PERL NET:SMTP (available from CPAN) (commonly used on Windows® server platforms) with an SMTP system pre-installed and configured. This optional requirement supports automatic email notification to the webmaster when execution errors are detected.
RTPG
Installation and Usage
FILENAME: rtpg.html
Following initial installation it is recommended that verification test is performed using the sample templates and data provided. Following successful verification of installation and configuration customize templates, data and configuration as desired.
Preparation
Verify target web server supports:
- HTTP 1.x
- CGI
- PERL 5.x
Determine:
- Directory path to the PERL executable
- CGI restriction to "/cgi-bin/" directory and subdirectories
- Locations for creation of "data" and "templates" directories
PACKING (PARTS) LIST
| PACKING LIST PRODUCT ID: RP |
|||
|---|---|---|---|
| COMPONENT | TYPE | SIZE | AUTH* |
| cgi-bin/geog.pl | TEXT | 11750 | 750 |
| cgi-bin/jhzcs.pl | TEXT | 47225 | 750 |
| cgi-bin/license.incl | TEXT | 7565 | 700 |
| cgi-bin/pg/rtpg.cfg | TEXT | 3138 | 750 |
| cgi-bin/pg/rtpg.cgi | TEXT | 30161 | 750 |
| cgi-bin/pg/rtpg.incl | TEXT | 62999 | 700 |
| data/rp/fb_afl/ALB.CAR | TEXT | 12867 | 750 |
| data/rp/fb_afl/ALB.GAM | TEXT | 800 | 750 |
| data/rp/fb_afl/ALB.GMS | TEXT | 33441 | 750 |
| data/rp/fb_afl/ALB.ROS | TEXT | 1305 | 750 |
| data/rp/fb_afl/ALB.SEA | TEXT | 5459 | 750 |
| data/rp/fb_afl/ALB.TEM | TEXT | 101 | 750 |
| data/rp/fb_afl/ARZ.CAR | TEXT | 18193 | 750 |
| data/rp/fb_afl/ARZ.GAM | TEXT | 884 | 750 |
| data/rp/fb_afl/ARZ.GMS | TEXT | 31620 | 750 |
| data/rp/fb_afl/ARZ.ROS | TEXT | 1516 | 750 |
| data/rp/fb_afl/ARZ.SEA | TEXT | 7091 | 750 |
| data/rp/fb_afl/ARZ.TEM | TEXT | 101 | 750 |
| data/rp/fb_afl/FLA.CAR | TEXT | 16945 | 750 |
| data/rp/fb_afl/FLA.GAM | TEXT | 924 | 750 |
| data/rp/fb_afl/FLA.GMS | TEXT | 40978 | 750 |
| data/rp/fb_afl/FLA.ROS | TEXT | 1461 | 750 |
| data/rp/fb_afl/FLA.SEA | TEXT | 6953 | 750 |
| data/rp/fb_afl/FLA.TEM | TEXT | 100 | 750 |
| data/rp/fb_afl/GRR.CAR | TEXT | 14905 | 750 |
| data/rp/fb_afl/GRR.GAM | TEXT | 936 | 750 |
| data/rp/fb_afl/GRR.GMS | TEXT | 38918 | 750 |
| data/rp/fb_afl/GRR.ROS | TEXT | 1160 | 750 |
| data/rp/fb_afl/GRR.SEA | TEXT | 7480 | 750 |
| data/rp/fb_afl/GRR.TEM | TEXT | 105 | 750 |
| data/rp/fb_afl/HOU.CAR | TEXT | 12671 | 750 |
| data/rp/fb_afl/HOU.GAM | TEXT | 874 | 750 |
| data/rp/fb_afl/HOU.GMS | TEXT | 36280 | 750 |
| data/rp/fb_afl/HOU.ROS | TEXT | 1249 | 750 |
| data/rp/fb_afl/HOU.SEA | TEXT | 6733 | 750 |
| data/rp/fb_afl/HOU.TEM | TEXT | 105 | 750 |
| data/rp/fb_afl/IWA.CAR | TEXT | 14637 | 750 |
| data/rp/fb_afl/IWA.GAM | TEXT | 940 | 750 |
| data/rp/fb_afl/IWA.GMS | TEXT | 36284 | 750 |
| data/rp/fb_afl/IWA.ROS | TEXT | 1347 | 750 |
| data/rp/fb_afl/IWA.SEA | TEXT | 6034 | 750 |
| data/rp/fb_afl/IWA.TEM | TEXT | 102 | 750 |
| data/rp/fb_afl/MIL.CAR | TEXT | 16536 | 750 |
| data/rp/fb_afl/MIL.GAM | TEXT | 979 | 750 |
| data/rp/fb_afl/MIL.GMS | TEXT | 37749 | 750 |
| data/rp/fb_afl/MIL.ROS | TEXT | 1496 | 750 |
| data/rp/fb_afl/MIL.SEA | TEXT | 6937 | 750 |
| data/rp/fb_afl/MIL.TEM | TEXT | 103 | 750 |
| data/rp/fb_afl/NAS.CAR | TEXT | 15916 | 750 |
| data/rp/fb_afl/NAS.GAM | TEXT | 851 | 750 |
| data/rp/fb_afl/NAS.GMS | TEXT | 36841 | 750 |
| data/rp/fb_afl/NAS.ROS | TEXT | 1330 | 750 |
| data/rp/fb_afl/NAS.SEA | TEXT | 6550 | 750 |
| data/rp/fb_afl/NAS.TEM | TEXT | 99 | 750 |
| data/rp/fb_afl/NJY.CAR | TEXT | 17043 | 750 |
| data/rp/fb_afl/NJY.GAM | TEXT | 971 | 750 |
| data/rp/fb_afl/NJY.GMS | TEXT | 39108 | 750 |
| data/rp/fb_afl/NJY.ROS | TEXT | 1045 | 750 |
| data/rp/fb_afl/NJY.SEA | TEXT | 6731 | 750 |
| data/rp/fb_afl/NJY.TEM | TEXT | 104 | 750 |
| data/rp/fb_afl/NYC.CAR | TEXT | 14141 | 750 |
| data/rp/fb_afl/NYC.GAM | TEXT | 949 | 750 |
| data/rp/fb_afl/NYC.GMS | TEXT | 37832 | 750 |
| data/rp/fb_afl/NYC.ROS | TEXT | 1221 | 750 |
| data/rp/fb_afl/NYC.SEA | TEXT | 5995 | 750 |
| data/rp/fb_afl/NYC.TEM | TEXT | 103 | 750 |
| data/rp/fb_afl/ORL.CAR | TEXT | 15089 | 750 |
| data/rp/fb_afl/ORL.GAM | TEXT | 859 | 750 |
| data/rp/fb_afl/ORL.GMS | TEXT | 36223 | 750 |
| data/rp/fb_afl/ORL.ROS | TEXT | 1300 | 750 |
| data/rp/fb_afl/ORL.SEA | TEXT | 6350 | 750 |
| data/rp/fb_afl/ORL.TEM | TEXT | 102 | 750 |
| data/rp/fb_afl/POR.CAR | TEXT | 14787 | 750 |
| data/rp/fb_afl/POR.GAM | TEXT | 934 | 750 |
| data/rp/fb_afl/POR.GMS | TEXT | 36483 | 750 |
| data/rp/fb_afl/POR.ROS | TEXT | 1292 | 750 |
| data/rp/fb_afl/POR.SEA | TEXT | 6035 | 750 |
| data/rp/fb_afl/POR.TEM | TEXT | 101 | 750 |
| data/rp/fb_afl/SJO.CAR | TEXT | 13466 | 750 |
| data/rp/fb_afl/SJO.GAM | TEXT | 877 | 750 |
| data/rp/fb_afl/SJO.GMS | TEXT | 37421 | 750 |
| data/rp/fb_afl/SJO.ROS | TEXT | 1302 | 750 |
| data/rp/fb_afl/SJO.SEA | TEXT | 5847 | 750 |
| data/rp/fb_afl/SJO.TEM | TEXT | 103 | 750 |
| data/rp/fb_afl/TAM.CAR | TEXT | 16718 | 750 |
| data/rp/fb_afl/TAM.GAM | TEXT | 853 | 750 |
| data/rp/fb_afl/TAM.GMS | TEXT | 35300 | 750 |
| data/rp/fb_afl/TAM.ROS | TEXT | 1218 | 750 |
| data/rp/fb_afl/TAM.SEA | TEXT | 6373 | 750 |
| data/rp/fb_afl/TAM.TEM | TEXT | 100 | 750 |
| images/JHZCS.gif | BINARY | 745 | 750 |
| logs/errorlog.txt | TEXT | 91 | 750 |
| tmpls/pg/RP_cat.htm | TEXT | 1173 | 750 |
| tmpls/pg/RP_idx.htm | TEXT | 931 | 750 |
| tmpls/pg/RP_item.htm | TEXT | 27277 | 750 |
|
*AUTH - Authorization/permissions octal equilvalents where: 7=RWX, 6=RW, 5=RX, 4=R (R=Read W=Write X=Executable) 1 char indicates Octal number 2 char Owner 3 char Group 4 char All Others |
|||
Installation
-
Create "/template/" and "/data/" directories and authorize them for group read access. A typical configuration would use directory names "/templates/" and "/data/". If possible, use those names for initial installation.
-
Modify Template references to "rtpg.cgi" to point to URL path where it will be installed. The templates are initially coded to point to "/cgi-bin/rtpg.cgi". If installing "rtpg.cgi" into the "/cgi-bin/" directory, no changes are required. Otherwise, modify the following templates:
rtpg_ds.tmpl
rtpg_fs.tmplThe following example shows "rtpg_ds.tmpl" with the line requiring modification in green.
<!-- JHZ-CS:Template:Main:Start --> <!-- JHZ-CS:Template:PInputs:#-TeamId --> <html> <title><<TEM:&#-TeamId:#-TeamName>> - Team Roster</title> <body bgcolor="#ffffff"> <h2><<TEM:&#-TeamId:#-TeamName>> - Team Roster</h2> <ul> <!-- JHZ-CS:Group:Players:Start --> <!-- JHZ-CS:Repeat:Players Repeat:Start --> <!-- JHZ-CS:For:[ROS:#-Name:#-Name ne x] --> <li><a href="/cgi-bin/rtpg.cgi?%23%2DTeamId=...</a> <!-- JHZ-CS:Repeat:Players Repeat:End --> <!-- JHZ-CS:Group:Players:End --> </UL> </body> </html> <!-- JHZ-CS:Template:Main:End --> -
Install Templates
FTP upload templates as TEXT.
rtpg_ds.tmpl dataset index rtpg_fs.tmpl fileset list rtpg_dt.tmpl item detail
-
System Configuration Settings
Depending on the Web Server platform:
UNIX/Linux/OSX
First line of code points to PERL executable. Modify as required to point to the path of the PERL executable. To determine location use "whereis perl" command.
#!/usr/bin/perl
Windows
A system registry entry must be associated for file extension ".cgi" to use "perl.exe".
Macintosh (OS 9)
On Macintosh, compile "rtpg.cgi" using the MacPERL 5.x compiler.
-
Modify RTPG Configuration File Setting
Set the values assigned to the configuration variables contained in the file "rtpg.cfg".
Set the following configuration variables as described below. Variables requiring modification are shown in green.
-
Set "site_root" to the "absolute" directory path of the website home directory.
-
Set "template_dir" to the relative directory path in relation to "site_root" so that the result of "site_root" + "template_dir" equates to the absolute path to the template directory.
-
Set "data_dir" to the relative directory path in relation to "site_root" so that the result of "site_root" + "data_dir" equates to the absolute path to the data directory.
* Windows95/98/NT Web Server platforms * MUST SET $CONFIG_FILE_PATH in rtpg.cgi * to path where this file resides * site_root points to root directory site_root= * template_dir and data_dir relative to site_root template_dir= data_dir= * dataset_template=rtpg_ds.tmpl fileset_template=rtpg_ds.tmpl item_template=rtpg_ds.tmpl * data_filename_case=U|C where: U = uppercase, L = lowercase data_filename_case=U * data_delimited_by=C|T where: C = comma delimited, T = tab delimited data_delimited_by=C * set data_file_prefix to referenced filename portion of key field * used for fileset and item processing (same as input parameter) data_file_prefix=#-TEAMID * dataset_suffix file extension of files for indexing dataset_suffix=.TEM * dataset_key is data-source as referred to in templates dataset_key=TEM * fileset_key and item_key are the key data fields and * input parameters for processing a fileset index and item detail * template fileset_key=#-TEAMID item_key=#-NAME
-
-
Install the Configuration File:
-
UNIX/Linux/OSX
Install "rtpg.cfg" into the directory where the CGI "rtpg.cgi" will reside.
-
Windows95/98/NT
Install "rtpg.cfg" in the directory where "perl.exe" will reside.
Exception
If server configuration prohibits installing "rtpg.cfg" into the directories describe above:
-
Determine the directory path where "rtpg.cfg" is to be installed. It may be installed in any directory accessible to the Web Server system.
-
Using an ASCII text editor, open the CGI script "rtpg.cgi" and locate the line of code $CONFIG_FILE_PATH = ""; as shown in the example below.
Assign the absolute directory path to where "rtpg.cfg" will be installed.
#******************************************** # CONFIGURATION FILE PATH - see ReadMe.html #******************************************** $CONFIG_FILE_PATH = "";NOTE: On UNIX/Linux the directory path will be the absolute path relative to the Web Server environment. On Windows95/98/NT the directory path will be the absolute path without a drive designation.
-
-
FTP upload "rtpg.cgi" and quot;rtpg.cfg" as TEXT.
-
FTP upload sample dataset as TEXT.
NOTE: When forcing lowercase names during FTP upload, modify "rtpg.cfg" configuration variable data_filename_case setting it to "L" prior to executing "rtpg.cgi".
After having completed the instruction steps above, initial installation is complete. Now, perform verification testing using the sample templates and data installed in the above steps. Following completion of verification testing, proceed to "Usage" section below and make desired modifications to customize the configuration as desired.
Usage
Invocation
Template Modification
Adding Ancillary Data to Templates
Invocation
Invocation is Input Parameter Driven. This means that the processing that occurs is based on the parameters passed as input.
- To generate a team list page, NO parameters are passed
- To generate a team roster page, TeamId is passed
- To generate a team player's statistics page, TeamId and Name are passed.
| Via the Browser Location Field | |
| Team List (default) | http://domain/cgi-bin/rtpg.cgi |
| Team Roster | http://domain/cgi-bin/rtpg.cgi?TeamId=value |
| Player Statistics | http://domain/cgi-bin/rtpg.cgi?TeamId=value&Name=value |
|
NOTE: For Browser Location Field invocation, parameter values containing special (non-alphanumeric) characters, such as commas, must be escaped using % followed by the characters ASCII value; i.e., comma %2C |
|
| Via a Web Page Hyperlink | |
| Team List (default) | <a href="http://domain/cgi-bin/rtpg.cgi>Team List</a> |
| Team Roster | <a href="http://domain/cgi-bin/rtpg.cgi?TeamId=value">Team Roster</a> |
| Player Statistics | <a href="http://domain/cgi-bin/rtpg.cgi?TeamId=value&Name=value">Player Statistics</a> |
|
NOTE: For Web Page Hyperlink invocation, parameter values containing special (non-alphanumeric) characters, such as commas, must be escaped using % followed by the characters ASCII value; i.e., comma %2C |
|
| Via an HTML Form | |
| Team List (default) | <form action="http://domain/cgi-bin/rtpg.cgi" method="post">
<input type="submit value="Team List"> </form> |
| Team Roster | <form action="http://domain/cgi-bin/rtpg.cgi" method="post">
<input name="TeamId" type=text value="value"> <input type="submit value="Team Roster"> </form> |
| Player Statistics | <form action="http://domain/cgi-bin/rtpg.cgi" method="post">
<input name="TeamId" type=text value="value"> <input name="Name" type=text> <input type="submit" value="Player Statistics"> </form> |
|
* Where value equals a valid #-TeamId or #-Name value within the TAS For Football CGI Data Generated dataset. NOTE: The example above reflects the Web CGI "rtpg.cgi" installed into "/cgi-bin/". If your configuration installs "rtpg.cgi" in another location, then replace the reference to "/cgi-bin/" with the correct path. |
|
Modifying Templates
This document describes the template mark-up syntax used by rtpg; Template Mark-up Tags as data references and Special Comments (template directives); the elements that instruct RTPG how to process your templates and data.
Template Mark-up Tags
Template Mark-up Tags represent replacement values within the resulting formatted page. Template Mark-up Tags are structured similar to HTML tags.
Syntax:
<JHZ-CS parms="data-source:data-key:data-item">sample-data</JHZ-CS>
NOTE: "sample-data" may be any value or null. Its purpose is to allow you to specify a value to be displayed while modifying your templates. This permits you to preview a template without having to continually process it to generate output. The sample-data value is discarded during normal processing.
|
data-source |
A value specifying the data file extension of the file containing the data. The sample data files have the following file extensions: TEM, ROS, GAM, GMP, GMB, SEA, CAR |
|
data-key |
A value specifying the key field used to acquire the data. Valid values are any data column name within the data file specified by data-source. |
|
data-item |
A value specifying the data item to use as replacement value, or calculated value (see below). Valid values are any data column name within the data file specified by data-source, or a calculated value (see below), within the specified data-source file. Data-item names prefaced with an ampersand (&) indicate an input parameter value. |
Calculated Values
Calculated values are represented as: one data-item, a mathematical operator, and a second data-item. supported mathematical operators are: multiplication (asterisk) "*", division (slash) "/", and percent (percent sign) "%".
Syntax:
<JHZ-CS parms="data-source:data-key:(data-item1 operator data-item2)"> sample-data </JHZ-CS>
NOTE: Precision for division is 1. Precision for multiplication is 0. Percentage is represented as precision 1.
Example:
This example is an abstract portion of a template´s header portion, using the tag syntax described above.
NOTE: Data items "#-TeamId" and "#-Name" prefaced with an ampersand "&" indicating the variable is also an input parameter on invocation:
<h2><JHZ-CS parms="TEM:&#-TeamId:#-TeamName">sample</JHZ-CS> <JHZ-CS parms="ROS:&#-Name:#-Player">sample</JHZ-CS></h2> <table cellspacing=0 cellpadding=5 border=0> <tr><th valign=bottom align="center">Uniform<br>Number</th> <th valign=bottom align="center">Class</th> <th valign=bottom align="center">Position</th> <th valign=bottom align="center">Bats</th> <th valign=bottom align="center">Throws</th> </tr> <tr><td align="center">#<JHZ-CS parms="ROS:&#-Name:#-Uni">sample</JHZ-CS></td> <td align="center"><JHZ-CS parms="ROS:&#-Name:#-Cl">sample</JHZ-CS></td> <td align="center"><JHZ-CS parms="ROS:&#-Name:#-Pos">sample</JHZ-CS></td> <td align="center"><JHZ-CS parms="ROS:&#-Name:#-Bat">sample</JHZ-CS></td> <td align="center"><JHZ-CS parms="ROS:&#-Name:#-Pch">sample</JHZ-CS></td> </tr> </table>
Special Comments (template directives)
"Special Comments" are directives that define how to process the template. The "Special Comments" are structured as HTML comments.
Syntax:
| <!-- JHZ-CS:type:name:params --> | |||||||
| type | Template|Group|CondGroup|Cond|Repeat|For|Where | ||||||
| Template | defines template start and end | ||||||
| params = Start|End | |||||||
| Group | unconditionally include this group | ||||||
| params = Start|End | |||||||
| CondGroup | conditionally include this group, followed by a minimum of one or more conditional (Cond) statements | ||||||
| params = Start|End | |||||||
| Cond | sets conditions for subsequent CondGroup statement | ||||||
| <!-- JHZ-CS:Cond:conditional-statement --> | |||||||
| where: | conditional-statement | (data-source:key:data_item oper value)
note: wrapped in parenthesis |
|||||
| data-source:key:data_item | a valid data item reference (see Special Markup Tags section) | ||||||
| oper | eq|ne|gt|lt|ge|le | ||||||
| value | any valid literal value (no quotes) | ||||||
| Repeat | repeating group, MUST BE followed by one For clause | ||||||
| <!-- JHZ-CS:Repeat:name:params --> | |||||||
| where: | name | arbitrary but unique for the repeat group | |||||
| params | Start|End | ||||||
| For | sets repeat criteria for subsequent Repeat; Required with Repeat clause | ||||||
| <!-- JHZ-CS:For:repeat-statement --> | |||||||
| where: | repeat-statement | [data-source:key:data_item oper value]
note: wrapped in brackets |
|||||
| data-source:key:data_item | a valid data item reference (see Special Markup Tags section) | ||||||
| oper | eq|ne|gt|lt|ge|le | ||||||
| value | any valid value or &varname where varname is a program input variable | ||||||
| Where | sets conditions of subsequent Repeat and For clauses; Optional | ||||||
| <!-- JHZ-CS:Where:conditional-statement --> | |||||||
| where: | conditional-statement | [data-source:key:data_item oper data-source:key:data_item]
note: wrapped in brackets |
|||||
| data-source:key:data_item | a valid data item reference (see Special Markup Tags section) | ||||||
| oper | eq|ne|gt|lt|ge|le | ||||||
| name | Main|PInput|string | ||||||
| Main | params is Start|End | ||||||
| PInput | params is variable name(s) of program input parameters (space delimited) | ||||||
| string | a unique value for a particular template group (Main and Pinput are reserved) | ||||||
| params | Start|End|conditional-statement|repeat-statement
as referenced above |
||||||
Template Start and End Special Comments
The beginning and end of a template is marked by a set of special comments. Input parameters are also specified.
End of the template is marked by a special comment as well.
Example:
<!-- JHZ-CS:Template:Main:Start --> <!-- JHZ-CS:Template:PInputs:#-Name #-TeamId --> ... <!-- JHZ-CS:Template:Main:End -->
In the above example, the first and last special comment indicates the start and end of the template. The second special comment, type="PInputs" defines the input parameter(s) for the template. Subsequent references to an input parameter is indicated by prefixing the data-item with an ampersand (&).
Template Groups
- Group
- Conditional Group
- Repeating Group (For)
- Repeating Group (For Where)
In addition to general data-item references, you may define sections of a template as a Group. Groups may be Conditional; referred to as Conditional Groups. Groups may be defined as Repeating Groups. Repeating Group will generate multiple lines base on its "For" clause. And, a "For" clause may also be conditional with the use of a "Where" clause.
|
Group |
Contains a group of HTML that may be condition and encapsulate one or more repeating groups |
|
Conditional Group |
A group that is conditionally generated |
|
Repeating Group (For) |
A subgroup that generates multiple time for each item specified in its For clause |
|
Repeating Group
|
A conditional subgroup that generates multiple time for each item specified in its For and Where clauses |
Group Examples
Below is an abstract portion of the provided Player Statistics template. It is the "Passing" Conditional Group within the template.
Examples
Group
This example shows a Group. A Group it is always generated.
<!-- JHZ-CS:Group:Fielding:Start --> ... <!-- JHZ-CS:Group:Fielding:End -->
Conditional Group
This example shows a Conditional Group "CondGroup"; only generated when criteria in " Cond" clause is met.
A "CondGroup" MUST contain one or more "Cond" clauses.
The "Cond" clause is wrapped in parentheses, containing: a data-item to compare, a logical operator, and a data-item to compare it against. Valid logical operators:
| eq | equal to (=) |
| ne | not equal to (!=) |
| gt | greater than (>) |
| lt | less than (<) |
| le | less than or equal to (<=) |
| ge | greater than or equal to (>=) |
<!-- JHZ-CS:CondGroup:Pitching:Start --> <!-- JHZ-CS:Cond:(SEA:&#-Name:P-App gt 0) --> ... <!-- JHZ-CS:CondGroup:Pitching:End -->
Repeating Group
This example shows a Repeating Group "Repeat". A "Repeat" consists of the "Start", a "For" clause, and an "End".
Optionally, a "Where" clause may be specified to qualify the "Repeat" making it conditional.
A Repeating Group MUST contain a "For" clause.
... <!-- JHZ-CS:Repeat:Pitching Repeat:Start --> <!-- JHZ-CS:For:[GMP:#-GameId:#-Name eq &#-Name] --> <!-- JHZ-CS:Where:[GAM:#-GameId:#-GameId eq GMP:&#-Name:#-GameId] --> ... <!-- JHZ-CS:Repeat:Pitching Repeat:End --> ...
Comprehensive Example - Conditional Repeating For Where Group:
Abstract portion of a Player Statistics template, showing a Conditional Group and a "Repeat", "For" and "Where" group:
... <h2>Season Statistics</h2> <!-- JHZ-CS:CondGroup:Batting:Start --> <!-- JHZ-CS:Cond:(SEA:&#-Name:B-G gt 0) --> <h3>Batting</h3> <table cellspacing=0 cellpadding=0 border=0> <tr> <th align=left>Opponent</th> <th width=5> </th> <th align=left>Date</th> <th width=20> </th> <th align=right width=25>Avg</th> <th align=right width=20>AB</th> <th align=right width=20>R</th> <th align=right width=20>H</th> <th align=right width=20>2B</th> <th align=right width=20>3B</th> <th align=right width=20>HR</th> <th align=right width=25>RBI</th> <th align=right width=20>BB</th> <th align=right width=20>SO</th> <th align=right width=20>SB</th> <th align=right width=20>CS</th> <th align=right width=25>SAC</th> <th align=right width=20>SF</th> </tr> <!-- JHZ-CS:Repeat:Batting Repeat:Start --> <!-- JHZ-CS:For:[GMB:#-GameId:#-Name eq &#-Name] --> <!-- JHZ-CS:Where:[GAM:#-GameId:#-GameId eq GMB:&#-Name:#-GameId] --> <tr> <td align=left> <JHZ-CS parms="GAM:#-GameId:#-Opponent">Coll. of Charleston</JHZ-CS> </td> <td width=5> </td> <td align=left> <JHZ-CS parms="GAM:#-GameId:#-Date">Feb 17, 1996</JHZ-CS> </td> <td width=20> </td> <td align=right><JHZ-CS parms="GMB:#-GameId:B-Avg">.333</JHZ-CS></td> <td align=right><JHZ-CS parms="GMB:#-GameId:B-AB">3</JHZ-CS></td> <td align=right><JHZ-CS parms="GMB:#-GameId:B-R">0</JHZ-CS></td> <td align=right><JHZ-CS parms="GMB:#-GameId:B-H">1</JHZ-CS></td> <td align=right><JHZ-CS parms="GMB:#-GameId:B-2B">0</JHZ-CS></td> <td align=right><JHZ-CS parms="GMB:#-GameId:B-3B">0</JHZ-CS></td> <td align=right><JHZ-CS parms="GMB:#-GameId:B-HR">0</JHZ-CS></td> <td align=right><JHZ-CS parms="GMB:#-GameId:B-RBI">2</JHZ-CS></td> <td align=right><JHZ-CS parms="GMB:#-GameId:B-BB">0</JHZ-CS></td> <td align=right><JHZ-CS parms="GMB:#-GameId:B-SO">0</JHZ-CS></td> <td align=right><JHZ-CS parms="GMB:#-GameId:B-SB">0</JHZ-CS></td> <td align=right><JHZ-CS parms="GMB:#-GameId:B-CS">0</JHZ-CS></td> <td align=right><JHZ-CS parms="GMB:#-GameId:B-SAC">0</JHZ-CS></td> <td align=right><JHZ-CS parms="GMB:#-GameId:B-SF">0</JHZ-CS></td> </tr> <!-- JHZ-CS:Repeat:Batting Repeat:End --> <tr> <td align=left colspan=3>TOTALS</td> <td width=20> </td> <td align=right><JHZ-CS parms="SEA:&#-Name:B-Avg">.107</JHZ-CS></td> <td align=right><JHZ-CS parms="SEA:&#-Name:B-AB">28</JHZ-CS></td> <td align=right><JHZ-CS parms="SEA:&#-Name:B-R">5</JHZ-CS></td> <td align=right><JHZ-CS parms="SEA:&#-Name:B-H">3</JHZ-CS></td> <td align=right><JHZ-CS parms="SEA:&#-Name:B-2B">1</JHZ-CS></td> <td align=right><JHZ-CS parms="SEA:&#-Name:B-3B">0</JHZ-CS></td> <td align=right><JHZ-CS parms="SEA:&#-Name:B-HR">0</JHZ-CS></td> <td align=right><JHZ-CS parms="SEA:&#-Name:B-RBI">3</JHZ-CS></td> <td align=right><JHZ-CS parms="SEA:&#-Name:B-BB">4</JHZ-CS></td> <td align=right><JHZ-CS parms="SEA:&#-Name:B-SO">5</JHZ-CS></td> <td align=right><JHZ-CS parms="SEA:&#-Name:B-SB">1</JHZ-CS></td> <td align=right><JHZ-CS parms="SEA:&#-Name:B-CS">0</JHZ-CS></td> <td align=right><JHZ-CS parms="SEA:&#-Name:B-SAC">0</JHZ-CS></td> <td align=right><JHZ-CS parms="SEA:&#-Name:B-SF">0</JHZ-CS></td> </tr> </table> <!-- JHZ-CS:CondGroup:Batting:End --> ...
Adding Ancillary Data to Templates
Adding ancillary data to template requires creating a new data file, installing it onto the web server data directory, then adding references to the ancillary data within template(s).
-
Create a new ASCII data file
Using a text editor, or spreadsheet application (Save As CSV Comma Delimited Text) create and name the file "teamid.ANC". The file should be installed in the TAS CGI data directory.
Data File Organization:
-
data columns - comma delimited (strings containing commas must be wrapped in double-quotes ("string")
-
records - are terminated by a new line on UNIX, a carriage return on Macintosh, and carriage return linefeed on Windows platforms. (Your FTP software should convert record terminator, if you FTP in ASCII format)
-
first record - is the data file header record, containing the names of the data column. Subsequent records are data records.
TIP: When creating your ancillary data file, make a copy of the teamid.ROS file, and name it "teamid.ANC", then remove unwanted data columns, keeping the #-NAME data column as the key data column with its values, then add your ancillary data columns; see below.
-
-
Create the data file's data column headers
At least one data column must be named the same and corresponding to like column within the primary dataset serving as the data key. In the example below to add Player information references within the Player Stats Template #-Name is used as the data key.
Create new data columns and name them using any alphanumeric values. The name you choose will be used to reference the data item, along with the data key column value.
Example:
Adds "photo" and "bio" data columns as
#-Name photo bio -
Add the data column values
Add a record for each player specifying the #-Name value found for the player in the teamid.ROS data file in the suggested key data column named #-Name (see TIP in step 2). Add the data for your additional data columns for each player.
Example:
Add values to photo and bio data columns
#-Name
photo
bio
BEAN
../images/bean.jpg
../bios/bean.html
BOOKCHECK
../images/bootcheck.jpg
../BIOS/bootcheck.html
COLVIN
../images/colvin.jpg
../BIOS/colvin.html
NOTE: Values shown above for "photo" and "bio" are directory path and filename values. They may be any value to be referred to within templates. This example illustrates use of values to be translated as part of HTML statements; as in the examples that follow.
-
Template Reference Syntax:
<JHZ-CS parms="ANC:&#-Name:ancillary-data-item"> sample-data </JHZ-CS>
Where ancillary-data-item is one of the data columns names you defined within "teamid.ANC" and sample-data is displayed only when displaying the template without execution of the CGI; for formatting use only; optional.
NOTE: The ampersand (&) prefix to #-Name, above, indicates #-Name is an input parameter for the template.
To add a player's photo to Player Stats Template, within the template add:
<img src="<JHZ-CS parms="ANC:&#-Name:photo"></JHZ-CS>" width=50 height=75 border=1>
To add the a link to the player's bio within the Player Stats Template, within the template add:
<a href="<JHZ-CS parms="ANC:&#-Name:bio"></JHZ-CS>">
Anything may be put into the data columns for reference within a template. For instance, instead of putting "../images/player-name.jpg" in the "photo" data column, the entire HTML markup for the image may be included.
Example:
Instead of defining the value
../images/bean.jpg
in the photo data column, instead define the value
<img src="../images/bean.jpg" width=50 height=75 border=1>
then, within templates, reference the photo by specifying
<JHZ-CS parms="ANC:&#-Name:photo"></JHZ-CS>
resulting in the entire HTML IMG reference being inserted during replacement processing.
FAQs
Is there a limit to the number of configuration files I can define?
No. The number of configuration files is limited only by the storage restrictions on your web server.
Do I upload and download data files as Text or Binary?
Use Text for both uploading and downloading data files.
Do I upload templates as Text or Binary?
Use Text for both uploading and downloading templates.
Do I upload images as Text or Binary?
Use Binary for uploading and downloading image files.
JHZ-CS Solutions are distributed exclusively under terms and conditions of the JHZ-CS Software License Agreement.
