Box 24

 Home   Infos   Tipps   Webmail   Humor   Polizei   Gästebuch   Downloads   Chat   Suchen   Feedback   Links 

 

 Anmelden/Login   Neuanmeldung/New User   Java Telnet Applet   Telnet   
 

Template processing

A major improvement to the WEB SERVER has been done in the area of HTML-XXXXXX.wcx and template processing. I will venture to say that the web server is about 50-60% faster now in processing templates because I moved the template processing from WCX into core library (it is now in C rather than WCX).

The benefits of WCT (Wildcat Templates):

  • Much faster processing of templates
  • Many more commands and processing power (summary listed below)
  • Limits removed in template variables. Before we were limited to 100 variables per template. No limits now!
  • compatible with old template system

I want to give developers and web developers a head-start in learning WCT. The following is a summary guide of the new system:

Wildcat Template Macros Quick Reference

@ IF condition@ structured block flow control
[@ ELSEIF condition@ | @ ELSE@]
@ ENDIF@

@ ECHO var@ return value of var
@ SUB var@ return value of var
@ SUB var=val@ set var, unquoted val is eval
@ SET var=val@ set var, unquoted val is eval
@ SET var=@ remove var from template memory.

@ MODULE UTL data@ load/run wcx program

@ FLASTMODE filename@ get the file date
@ FSIZE filename@ get the file size

@ ESCAPE url@ escape url

@ INCLUDE template_file@ include file into current position
@ EXISTINCLUDE filename@ if file exist, include it

@ COUNTER [filename]@ return counter in text format, default filename is base\main.ctr

@ LOOP tag@ begin loop until endloop or break
@ ENDLOOP@ end loop
@ BREAK@ break loop

Built-in Template Global Variables

TRUE value -1
FALSE value 0
YES value -1
NO value 0

HelpEnabled true if html-help.wcx exist
HelpPage url (filename) for help page
HelpDefault default help url

Anonymous true if current user is anonymous (WC6 ONLY)

FrameMode true if user is in frame mode
ThreadMode true if user is in mail thread mode

AllowSignup True if System Acceess is saOpen
(or saClosedValidate in WC6)

@ IF@ condition evaluation syntax:

[pop]variable1 [iop <variable2>] [sop <condition> ....]

EXIST "filename"

prefix operators (pop):
! not condition

infix operators (iop):
= equal
> greater
< less
<> not equal
? test variable1 string in right variable2 string

suffix operators (sop):
|| boolean OR, a new condition will follow
&& boolean AND, a new condition will follow

Notes

1) Short Circuiting is supported in multi-conditional statements.

2) No parenthesis are supported. Conditions must be in expanded form.  using Demorgan's theorem. Conditions take precedence over AND or. OR conditional pairing in left to right order. Short circuiting will determine whether or not the next condition needs is to be evaluated.

Since parenthesis are not supported, the not (!) operator is applied to a condition, not the entire multiple conditional statement. For example, if you wish to programmatically establish a multiple conditional statement such as:

!(condition1 && condition2)

then use Demorgan's Theorem to expand the conditions to:

!condition1 || !condition2

Example template usages:

Using new INCLUDE, EXISTINCLUDE commands:

In this example, we are illustrating the new powerful include file option where each template file will include a header and footer for a HTML page. The difference between INCLUDE and EXISTINCLUDE is INCLUDE will show an error if the file did not exist. So by having EXISTINCLUDE, we make headers and footers optional.

<html>
  <body>
    @ existinclude "wc:\http\template\pageheader.inc"@
    <p> add your normal stuff</p>
    @ existinclude "wc:\http\template\pagefooter.inc"@
  </body>
</html>

Using the new SET and expanded IF commands

In this example, we are including a global template so that we can set variables and check for a system WARNING file.

<html>
  <body>
    @ existinclude "wc:\http\systemevents.txt"@
    @ existinclude "wc:\http\template\pageheader.inc"@
    @ if SystemEvent@
      <H3> SYSTEM EVENT: @ sub SystemEvent@ </H3>
    @ endif
    @ if exist "wc:\http\warning.txt"@
      <H3> We have a WARNING!!!! </H3>
      <H1> @ include "wc:\http\warning.txt"@ </H1>
    @ endif
    @ existinclude "wc:\http\template\pagefooter.inc"@
  </body>
</html>

In the systemevents.txt, you can have something like this:

@ SET SystemEvent="System event in 10 minutes! Logoff now!"@

The above is just a few items of what's now possible with the new WCT system.

© 2001 Hector Santos, http://www.santronics.com