http://mydomain.com/ALIAS/SYSPARAMETERS/TEMPLATEPATH/PARAMETERS

URL

http://mydomain.com/ALIAS/SYSPARAMETERS/TEMPLATEPATH/PARAMETERS

The templateengine is based on the following structure:

The url provides the needed information what template is processed and can contain an unlimited number of parameters and sysparameters.

http://mydomain.com/ALIAS/SYSPARAMETERS/TEMPLATEPATH/PARAMETERS
 
http://tt2.adulteducation.at/4/de/sub1/sub2/templatename/param0/param1/param2/param3
http://tt2.adulteducation.at/4/de/subA/subB/param0/param1/param2/param3
http://tt2.adulteducation.at/4/de/debug-time/subA/subB/param0///param3
http://tt2.adulteducation.at/4/de/debug-time-test/subA/subB/param0///param3

The function url is designed to produce exactely this structure given on the provided path,parameters and addons.

alias

is a systemdependant part, which has no effect to the templates at all. [tech]: It is used on serverside to offer more engines at the same time or other reasons and corresponds with a line in your apache.conf like the following Alias /4 /data/apache/knowledge/tt2/bin/tt2_4.pl or you can use a direkt apache-handler

sysparameters

are global parameters that are transparent for the templates. The system filters out that information and provides information to it via the sys-variable-tree. The sysparameters are seperated via / as well so the whole url looks like any url.

format and order

note that each sysparameter is optional, but if used the order is important !!

/LANGUAGE/OPEN/DEBUG

language

the first sys-parameter is a two-letter-code which is considered as languagecode and processed. If there is no such code, the default-language german is assumed. In the output of url the languagecode is always present !!

open

Then an optional sys-parameter open-TEXT can be processed. for each digit or letter X in TEXT the variable sys.open.X will be set to 1 to signal a status of the script. Note that sys.open itself is a hash and not an array and therefore also letters can be used.

The open-value is sticky and can be changed via the open, or the openX - addons in the url-function. The noparam-addon also clears the open-value and open=>”” clears only the open-value.

current usage of open parameters

debug

Then an optional sys-parameter debug-KEYWORDS can be processed. It is is intended for development only and will not be processed in the final release !! The keywords are seperated by dashes (-). Possible keywords:

  • time : will print the time needed to create the template in the first line after the <body>-tag
  • dump : the whole internal datastructures are printed at the beginning in the first line after the <body>-tag. Note that this can be a very long text, when doing intense db-queries or using some search-plugins
  • mem : print out the mem-stat of the current thread. useful for debugging memleaks and controlling big dataqueries
  • circtest : check for circular references in the used object. useful for debuggin memleaks. Note that this can take a very long time on big datastructures. It is definetely a stupid idea to use circtest when doing a bigmemtest with a $#50000000-array :)
  • cache : eliminate no-cache-pragmas in html-source
  • optimize : optimizes the generated html-code in several ways:
    • eliminate multiple whitespaces (empty lines, two or more space/tabs)
  • size : print size of the generated html-code without header. This size is not correct, cause the size of the “size=xxxx bytes” itself and the output of the optional time-sysparameter are not included :) This parameter is useful for testing the optimize-algorithm and not for exact values. For this check the content-length-header of the delivered page or count yourself :)
  • dbg : print outs the content of $var->{debug_val} that can be filled with individual content by the programmer of the templateengine for debug-purpose
  • no_replace : does not print any small_text or alt_text, but prints the referrer instead

templatepath

the path and name of the template in the real-world-structure in the ftp-folder. You can specify pathnames and templatenames (without the trailing .tt2) here. If the system can find no template then the defaulttemplate index.tt2 in the last folder is used. The engine processes the url and takes as much as possible as templatepath. So be sure never to use a foldername or templatename that might possibly become the first parameter !!

example:

assume the following structure of the ftp-directory

.
|-- index.tt2
|-- sub1
|   |-- index.tt2
|   |-- subA
|   |   |-- hans.tt2
|   |   `-- index.tt2
|   |-- subA.tt2
|   |-- subB
|   |-- subC
|   `-- test.tt2
|-- sub2
|   `-- index.tt2
`-- sub3

so you can use the following for templatepath:

sub1/subA/hans => sub1/subA/hans.tt2

sub1/subA => sub1/subA/index.tt2 und nicht sub1/subA.tt2 !!!!

sub1/subC/test => sub1/subC/test.tt2

sub1/subC => ERROR no such template, weil sub1/subC/index.tt2 nicht existiert !!!

parameters

the parameters are splitted with the usual url-delimeter ‘/’. so no parameter should contain this character as letter. Even more complicated unicodeparameters should be delivered via the url, cause there is no standardencoding yet. If such parameters need to be transported via url, the parameters need to be encoded and decoded in a special way. This encoding and decoding can be provided by the engine transparently if necessary. empty parameters are ok like param1/param2//param4. Then we have an empty third parameter.

 
kb/templateengine/struktur.txt · Last modified: 2007/10/15 23:23 by peter