FUNKTIONEN

liste aller engine-funktionen

parameter, die optional sind, werden in eckigen klammern geführt. Diese Parameter können, müssen aber nicht angegeben werden. Die eckigen Klammern selbst sind in der Funktion nicht anzugeben, sofern es nicht explizit erwähnt ist.

search-functions

Eine Übersicht über die Suche mit weiterführenden links findet sich unter Suchübersicht

search1

usage:

search1(namespace,searchterm,{addons})

results:

db.$NAMESPACE

description:

looks up the searchterm in the searchindex and returns the result under the defined namespace in a format similar to the return of get_data.

varibales:

name and searchterm are quite obvious. addons is much more difficult and maybe concern of needed simplification. addons is a hash with following keys:

showme ...  list of all configs where I want to see real data and not only the overview.
showme=>[{config=>CONFIG1,
          sortmode=>SORTMODE,
          page=>PAGE,
          limit=>LIMIT,
          offset=>OFFSET,
          pre_fields=>[field1,field2,field3...]},
         {config=>CONFIG2,sortmode=>SORTMODE,page=>PAGE,limit=>LIMIT,offset=>OFFSET},
          ....
        ]
restrict_db ... restrict search to these databases (commaseperated)
restrict_fields ... restrict search to these fields
defaultop ... take this operator as defaultoperator if no operator is given

where CONFIG is the name of the configs we want to show. sortmode can be 0 or 1 for the alternate sortcriteria. PAGE is the pagenumber to show (starting at 1). Alternative to page the offset can be specified and limit is the number of entries to show per page. pre_fields is a new parameter that allows the exact specification of the fields that should be returned by the search. By default the fields specified in the search_config are returned and this is by far the fastest attempt, so this parameter should only be used for very special needs.

Please note that offset should always be a factor of limit. If not then the searchfunction will correct the offset. Note that specifying the page is prefered and the offset-parameter is only avaiable for compatibility-issues.

page1: offset=0 limit=30 page2: offset=30 limit=30 usw.

Please note that there is special CONFIG named “showterm” which will return the list of “matched terms”. So make sure that showterm is not used as standard configname.

returnvalue:

please note that CONFIG stands for database here

 db.NAME.err
 db.NAME.errstr
 db.NAME.rows           ... total number of results
 db.NAME.query          ... the original searchterm
 db.NAME.query_ext      ... the extendend searchterm for complex-searches only 
 db.NAME.query_short    ... the shortended searchterm for complex-searches only
 
 db.NAME.timing         ... timing-information. for debugging only !! (hash-tree for Data::Dump)
 db.NAME.total_terms    ... total number of all matched terms
 db.NAME.matched_terms  ... matched terms as list
 db.NAME.overview       ... a list of all configs that returns a result
 db.NAME.overview.NR.config ... name of the config
 db.NAME.overview.NR.results ... number of results in this config

note that overview is only available for compatibility-issues and overview2 is the new standard. overview is simply a list of all databases returned by the search while overview2 contains a structured version of the same list. The structure is defined in the searchconfig. Please note that databases are only included in overview2 if included in the just mentioned searchconfig.

 db.NAME.overview2      ... a ordered list of all modules and databases that returns a result
 db.NAME.overview2.NR.module ... name of the module
 db.NAME.overview2.NR.results ... number of results in this module
 db.NAME.overview2.NR.db   ... a ordered list of all databases inside this modules that returns a result
 db.NAME.overview2.NR.db.NR.config ... name of the config
 db.NAME.overview2.NR.db.NR.longname ... name to display for this config
 db.NAME.overview2.NR.db.NR.results ... number of results in this config
 db.NAME.data.CONFIG    ... a list of all results in this config
 db.NAME.data.CONFIG.NR.nr .. increasing number
 db.NAME.data.CONFIG.NR.url .. url
 db.NAME.data.CONFIG.NR.id .. datensatz-id
 db.NAME.data.CONFIG.NR.FIELDNAME1 .. value1
 db.NAME.data.CONFIG.NR.FIELDNAME2 .. value2
 db.NAME.data.CONFIG.NR.FIELDNAME3 .. value3

note that not all fields are returned in db.NAME.data, but only the three that are configured to be needed for the searchoverview.

 db.NAME.info.CONFIG       ... more detailed parameters for the search and its results
 db.NAME.info.CONFIG.total.longname ... name of this config
 db.NAME.info.CONFIG.total ... total searchresults for this config (same value as in db.NAME.overview2.NR.db.NR.results)
 db.NAME.info.CONFIG.retrieved ... number of results retrieved in the actual query (depending on page and limit)
 db.NAME.info.CONFIG.offset  ... the specified/calculated offset
 db.NAME.info.CONFIG.page    ... the specified/calculated page
 db.NAME.info.CONFIG.from    ... number of first retrieved entry (starting at 1)
 db.NAME.info.CONFIG.to      ... number of last retrieved entry
 db.NAME.info.CONFIG.sortmode ... the sortmode
 db.NAME.info.CONFIG.pre_fields ... ordered list that holds the fieldnames to show 
 db.NAME.info.CONFIG.pagination      ... gives a pagination for the result
 db.NAME.info.CONFIG.pagination.prev ... gives the number of the previous page IF THERE IS ONE
 db.NAME.info.CONFIG.pagination.next ... gives the number of the next page IF THERE IS ONE
 db.NAME.info.CONFIG.pagination.act  ... gives the number of the actual page (same value as db.NAME.info.CONFIG.page)
 db.NAME.info.CONFIG.pagination.maxpage ... gives the number of the last page
 db.NAME.info.CONFIG.pagination.pages ... list of pages to show in pagination  (ie: 4,5,6,7,8,9,10,11,12)

example:

search1(’test’,’stefan or markus’,{showme=>[{config=>’artikelindex’,sort=>0,offset=>30,limit=>30}],restrict_db=>’sd,sd2005’,defaultop=>’and’})

get_module_url

usage:

get_module_url([db-short])

results:

relative url is returned as direct result.

description:

for the supplied module-shortcut (ie ‘ta’) it provides the relative url of this module (ie. /literatur/textarchiv). If no argument is given, then the cgi.urlparam.2 is used which contains the moduleshort in most (all???) of the searches.
If the supplid module-shortcut is nonsense the method delivers an empty result


examples:

get_module_url()   ... delivers /literatur/textarchiv if url is 
                                  .../erweitertesuche/suchergebnis/peter/ta/1/#suchergebnis
get_module_url('zt')  .. delivers /literatur/zeitschriftentitle
get_module_url('nonsense') ... delivers an empty return.

get_sticky

usage:

get_sticky(term_ext,[cgi_object])

results:

term is returned as direct result. additional the cgi-values cgi.param.X and, if cgi-object is specified cgi_object.params.X are set according to the processed values

description:

process the extended term that stores all values for each field in the complex-form and recreates the pure searchterm term and set all cgi-field-values to the retrieved values.

if a cgi_object is specified, then the values of this object will be set too !!

restrictions inside this function limits the maximum length of the fieldshortcuts that are present in the extended term to 20 (can be easily adpated if necessary)

clear_cgi

usage:

clear_cgi(list)

results:

alle cgi-parameter complexNN are deleted where NN is part of the supplied list.

description:

for variying forms we need to have the possibility to delete several cgi-params of the form complexNN.

examples:

[% clear_cgi(1,4,6) %]
[% clear_cgi(1..5) %]
[% clear_cgi(1,4..8,9,11..18,23,99) %]

search_??_complex

For implementation of Complex_search_forms there are a variety of module-specific functions that are listed at search_??_complex

data-retrieval

get_data

usage:

get_data(namespace,database,[order,where,offset,limit])

results:

db.$NAMESPACE

description:

fetches data from the mentioned database and returns the result in the db-variable-tree under the defined namespace
note that the order-parameter can be any valid SQL-order-statement, including multiorder like ‘field1,field2’ or functions.

note that on failure the data-namespace will be empty.

note that several statusinformation (error, returned rows ...) is stored to the namespace as well. Look at variablen for details

please note that get_data() is aware of multilanguage-table and returns the data in the correct language in case of multilanguage-tables.

note that the parameter database can be extendend to hold a full sql-statement itself. This is mainly for internal use. For details refer extended get_data.

example:

get_data(’s2000’,’struktur2000’,’plz’,”ort~*’viellach’“,0,10)

get_count

usage:

get_count(database)

results:

number of entries in this database

description:

note that this method claims the namespace xxx for internal usage of getsql.

get_sql (deactivated)

usage:

get_sql(namespace,sql-command)

results:

db.$NAMESPACE

description:

performs the submitted sql-query and fetches data from the mentioned database and returns the result in the db-variable-tree under the defined namespace.

note that this function is deactivated for security-reasons. wrong sql-statements can mess up a whole life :)

get_extra

usage:

get_extra(name,[parameter..])

results:

extra.$NAME or as described in the doc for each function

description:

provides some extra calculation/databasefetching and returns the result. For currently implemented extrafunctions look at extrafunktionen

example:

get_extra(’bundeslaender’)

zitat

usage:

zitat(db,data)

results:

returns the fullquote (”VollZitat”) for the given dataentry

description:

db ist the shortcut of the database we need a “fullquote” for. and data is the entry of the data as returned by get_data or by special usage of search, where all needed fields are supplied via the pre_fields-directive in the show-option.

example:

get_data(test,'artikelindex','id_artikel','id_artikel=60002')
zitat('za',db.test.data.0)

availibility:

currently are the following databases available for “zitat”

  • za
  • wm
  • uf
  • zt

this function is design for extension

navigation

usage:

navigation()

results:

returns the full structure of the site-wide navigation

description:

meta-content

get_alt

usage:

get_alt(name)

results:

direct returnvalue is the text related to NAME in the actual language

description:

delivers an alt-text for an image in the actual language. The alt-text for each NAME and language is stored in the meta-content/alt_text-database. If there is no entry for NAME and the actual language, the system tries to return the text in the language SYS.LANG2 and if this fails also it tries to return the german version and finally it reverts to a debug-error-message

The syntax of the alt-text-database is very simple: NAME1: TEXT1 NAME2: TEXT2 NAME3: TEXT2

note that the : is optional and can be dismissed

For each language there is a single entry in this database. TEXT may contain whitespaces but not linebreaks

example:

get_alt(’test’) => das ist ein testbild get_alt(’test’) => this is a testpicture

the result depends on the values of sys.lang and sys.lang2

get_small

usage:

get_small(name)

results:

direct returnvalue is the text related to NAME in the actual language

description:

similar to get_alt. However the data is fetched from the small_text-database and can contain scalars and lists. The format is similar to the alt_database. If you want to specifiy a list, each element needs to be leaded by a whitspace and an asterix

NAME1: value
NAME2: *value0 *value1 *value2

Intention of this database is to store small textes that are not alt-textes.

example:

get_small(’NAME1’)
get_small(’NAME2’).0

get_pre

usage:

get_small(name,[lang])

results:

direct returnvalue is a hash to the requested pretext. hashkeys are teaser and text.

description:

the pretext “name” is fetched from the pretext-database in the actual language or, if a different languages is submitted as argument, in the specified language. If there is no pretext in this language, then the pretext in lang2 (a sysvalue) is returned. If there is no such pretext then the german pretext is returned and if there is no such pretext either a hash with errormessages is returned.

note that name is caseinsensitive !!

example:

[% get_pre('main1').teaser %]
[% get_pre('main1','es').text %]

get_small_upper

same as get_small, but the textes are returned uppercase and german umlauts Ä,Ö,Ü,ß are translated to the corresponding html-entities. (Ä=>Ä)

Note that in the used locale the uppercase of ß is SS anyway.

Note that this is function is a shortcut to uppercase(get_small(’NAME’))

get_imgp

usage:

get_imap(NAME,[LANG])

results:

direct returnvalue is the full imagepath for the image NAME in the current language-subfolder

description:

Textimages depend on the current language as well. With this function for a given NAME the full path of the corresponding image depending on the value of sys.lang is returned. The image can contain path-information (relative to the language-image-folder in the ftp-path) as well. If no extension is given, then the system assumes a gif-image and add this extension automatically. Allowed extenstions are jpg, gif, pnp (lowercase)

If you dont want to use the current language you can provide the language of your choice as second function of this parameter.

If a image does not exist in the requested language then the english version is returned. If this does not exist either, the german version is returned.

url

usage:

url([param1,param2,param3...],[addons])

results:

direct returnvalue is a url that points to another template in the templateengine-universe with parameters and optionally altered systemparameters. The returned url always ends with a trailing ‘/’

description:

parameters are just the urlparameters you want to add to the url. If you want to reuse the actual parameters and change only a few of them, just dont specify any parameters here. To make this clear: if you dont specify any parameters here, this means that the old parameters are used (regarding the changes specified in the addons). If you dont want parameters, take a look at the noparam-addon. If you specify the noparam-parameter you can of course set new parameters and open-values using the p# and open#-directives.

addons is a hash of addons. possible addons:

  • lang : specify a different language
  • debug : specify a different debug-sys-parameter
  • path : specify a different path/template the url should point to
  • noparam : dont give any urlparameters and clear the open-value
  • p# : explicetely change/set a urlparameter. # is a number 0-infinity
  • open : set the open-sys-value
  • openX : set the specific open-value to 0 or 1 while keeping the others

Note that path can be absolute or relative to the current template or external. The path is absolute, when it starts with “/”, its external when it starts with 'http://' and relative otherwise. The path can contain the standard relative-paths-variables “..” and “.”. These variables are substitute in the usual way. The template-extension .tt2 does not need to be specified nor does the default-template index.tt2. If specified the unnecessary parts are removed for the sake of good-looking

as you see, the urlparameters can be specified as direct parameters to the function or as addons. You can use both ways. The direct way is intended if you want to specify completely different parameters then the current used. The way via the addons is used if you want to use the current urlparameters but change a few of them. Note that the addons override the direct specified if you use both !!

please look at struktur to get the difference between path and parameters

note that in the current version, the functions tests if the supplied path leads to an existing template !! If this is not the case, the returned url will be something like:

/4/de/______nosuch_path_/peter/sub1_________/hans/emil 

where the url between the many underscores is the wrong url plus the leading errormessage


\\Please note that in case of external urls all addon-parameters but “path” are ignored as they dont make sense with external urls. The parameters supplied as array are added as suburls to the url mentioned in path. see example below.

example:

assumed current url:
http://tt2.adulteducation.at/4/de/peter/test1/oldparam0/oldparam1/oldparam2
[% url() %]
=> http://tt2.adulteducation.at/4/de/peter/test1/oldparam0/oldparam1/oldparam2
[% url({lang=>"en"}) %]
=> http://tt2.adulteducation.at/4/en/peter/test1/oldparam0/oldparam1/oldparam2
[% url({p1=>"newparam1"}) %]
=> http://tt2.adulteducation.at/4/de/peter/test1/oldparam0/newparam1/oldparam3
[% url({p9=>"newparam9",lang=>"en"}) %]
=> http://tt2.adulteducation.at/4/en/peter/test1/oldparam0/oldparam1/oldparam3//////newparam9
[% url("param0","param1","param2",{path=>"/sub1"}) %]
=> /4/de/sub1/param0/param1/param2
[% url("param0","param1","param2",{path=>"sub1",p1=>"other_param"}}) %]
=> /4/de/peter/sub1/param0/other_param/param2
[% url("param0","param1","param2",{path=>"../sub1"}) %]
=> /4/de/sub1/param0/param1/param2
[% url("param0","param1","param2",{path=>""}) %]
=> /4/de/peter/param0/param1/param2
[% url({open5=>1}) %]
=> http://tt2.adulteducation.at/4/de/open-5/peter/test1/oldparam0/oldparam1/oldparam2
[% url({path=>'http://www.goldfisch.at') %]
=> http://www.goldfisch.at/
[% url({path=>'http://www.goldfisch.at/goldfisch') %]
=> http://www.goldfisch.at/goldfisch/
[% url('goldfisch',{path=>'http://www.goldfisch.at') %]
=> http://www.goldfisch.at/goldfisch/
[% url('goldfisch','hans',{path=>'http://www.goldfisch.at') %]
=> http://www.goldfisch.at/goldfisch/hans/

pl

usage:

pl(”param1”,”param2”,”param3”)

results:

the direct result is the joinment of the parameters to add them as part of the url

description:

this function is merely used by the function url to create a /-seperated joins of delivered parameters. The parameters get the necessary encoding to be displayed as part of the url and be enabled for sucessful decoding later. By now direct use of the pl-function is not encouraged.

example:

[% pl("param1","",$cgi.urlparam.0,"ende") %]

output-functions

wiki1

extended wiki-syntax

usage:

wiki1(value,[img_prefix],[img_url])

results:

converts the input-text to html based on extended wiki-standards

An optional img_prefix and an option img_url can be submitted to tell where the images are stored. img_prefix defaults to empty and img_url to medienpreis. (for compatibility-reasons)

description:

The wiki-text is converted to html.

example:

[% get_data('x','sys_texte','id',"id=$id") %]
[% e=db.x.data.0 %]
[% wiki1(e.sys,'','medienpreis') %

</code>

wiki2

simple wiki-syntax (as used in onlinehistoriografie)

usage:

wiki2(value)

results:

converts the input-text to html based on simple wiki-standards

description:

The wiki-text is converted to html.

example:

[% get_data('personen','oh_personen','id',"id=$id") %]
[% e=db.personen.data.0 %]
[% wiki2(e.content) %]

oh_crosslink

used in onlinehistoriografie - see crosslinks

usage:

oh_crosslink(linkshortcut)

results:

converts the link-shortcut to a real link

example:

P12   ... /de/historiografie/personen/12
A123... /de/historiografie/ausstellungen/123
/de/hans ... /de/hans
http://www.goldfisch.at  .. http://www.goldfisch.at

int_cut

usage:

int_cut(value,[position])

results:

gives the truncated value as direct result.

description:

A value is truncated at the given position. The truncation takes place at the optional position, where position usually is a power of 10. position=1 is the defaultvalue which do a usual truncation.

Note that the input-value does not need to be an integer, nor does the result. The name of the function is therefore maybe not the best :)

Please note that comma is always a dot ‘.’, while the parameterseperator is always a ‘,’

example:

int_cut(12.45) = 12
int_cut(12.45,10) = 10
int_cut(12.45,0.1) = 12.4
int_cut(1271,10) = 1270

uppercase

usage: uppercase(ELEMENT)

ELEMENT can be a string, a list or a hash.

results:

direct returnvalue is the html-encoded uppercase of ELEMENT. if element is not a string, not a list and not a hash the returnvalue is empty.

description:

converts the specified value(s) to uppercase using the locale LC_TYPE de_AT.UTF-8. Additionally the unicode-representations for the german umlauts are converted to their corresponding html-entitites (Ä=>&Auml:)

note that there is a implemented filter which performs a different conversion for all MSIE on Mac (m/MSIE.*Mac_PowerPC/) cause this browser is not capable to display such characters in dropdown-menues. So Ä is converted to AE and so on.

example:

uppercase(get_small(name).0)
uppercase(get_small(name)).0

break

usage: break(text)

results:

direct returnvalue is the text with all linebreaks like \n and \r replaced by <br>

description:

replaces all text-line-breaks with html-breaks

remove_p

usage: remove_p(text)

results:

direct returnvalue is the text with all <p> and </p>-tags removed

description:

remove all <p> and </p>-tags

class_ww

usage: class_ww(text,[classname])

results:

direct returnvalue is the text with all class-attributes removed from all tags and replaced by the supplied classname. If no classname is given, then AUTO is the default class-name.

description:

replaces all class-attributes in html-tags with a different class-name

example:

class_ww(e.html,'SOP')

makes the following changes to the supplied text

<b>fetter text</b>  => <b class="SOP">fetter text</b>
<b class="maun">fetter text</b>  => <b class="SOP">fetter text</b>
<p class="maun"> => <p class="SOP">
<h1>haus</h1> => <h1 class="SOP">haus</h1>
and so on

author:

The regexp for this method was genourously gifted by werner weichselberger who was eager to do some perl-art ;)

# Remove all class tags
s{(<\w+(?:".*?"|'.*?'|.)+?>)}{my$r=$1;$r=~s/\s+class\s*=\s*(?:".*?"|'.*?'|\w*)//i;$r}eg;
# Insert new class tags
s{(<\w+)(.*?>)}{$1 class="TA_AUTO_HTML"$2}g; 

class_wwp

usage: class_wwp(text,[classname])

description:

This method works exactely as -> class_ww with one big difference: it does not alter the class-attributes of the <td>-tag. The reason for this is that our wiki-engine delivers two different classes for this tag to distinguish between differenty types of table-cells.

masq_quotes

usage: masq_qutoes(text)

results:

direct returnvalue is the text with double-quotes masqueraded.

description:

For the value-tag and many others have double-quote " as delimiter we cannot use this quotes inside the text and need to masquerade it with html- or unicode.

example:

masq_quotes("Peter")    = &quot;Peter&quot;

uri_escape

usage: uri_encode(text)

results:

direct returnvalue is the uri_encoded text

description:

This method encodes the Text to be presented in urls or any other latin-affected environment. This method is merely for testing. Please use the -> url()-method instead.

logical funtions

is_select

usage: is_select(CGIPARAM,VALUE)

results:

returns 1 if VALUE is one of the values in CGIPARM
returns 0 otherwise

description:

If CGIPARAM is a multiselect-parameter, it can contain several values. This values are seperated by \0. This method compares all values of CGIPARAM with VALUE and return 1 if at least one comparision is successful. Note that CGIPARAM can also be a single value. In this case a single simple compare between the two submitted parameters is performed

example:

<select multiple name="complex1">
[% FOREACH val = uppercase(get_small('str_ana_auswahl')) %]
  [% IF is_select(uppercase(cgi.param.complex1),val) %]  
     <option selected>[% val %]</option>
  [% ELSE %]
     <option>[% val %]</option>
  [% END %]
 [% END %]
 </select>

msplit

usage:

msplit(text,[sep1,sep2])

results:

returns a list of lists that contains the splitted values

description:

This method is able to split multiseperated textvalues. A string that is packed like T11-T12/T21-T22/T31-T32 can be splitted in its parts T11 T12 T21 .. with this method. The seperators can be optionally submitted, if other seperators than the defaultseperators & and \0 are used.

Note that this method is developed mainly to split entries from multifilefields

examples:

[% FOREACH attach=msplit(d.attachments) %]
  [% attach.0 %]-[% attach.1 %]<br>
[% END %]

diverses

mailform

usage: mailform([addon])

results:

mail the submitted form-values to a emailadress.

description:

The function mails the current url and all/some form-values (sys.cgi.params) to an emailadress.

defaultvalues:

  • to : cm@adulteducation.at
  • subject : feedback from adulteducation.at
  • fields : send all cgi-fields in email

The addon-parameter can change this defaultvalues.

example:

mailform()                       ... sends all cgi-fields and the actual url to cm@adulteducation.at with the subject "feedback from adulteducation.at"
mailform({to=>'pilsl@goldfisch.at',subject=>'test'})  ... sends all fields to pilsl with subject test
mailform({fields=>['complex0','complex1']})           ... sends only the fields complex0 and complex1

today

usage:

today()

results:

current date in format d.m.yyyy

description:

returns the current date

news_simplify_date

usage:

news_simplify_date(datum1,datum2)

results:

returns a simplified date-range from datum1 to datum2

description:

datum1 and datum2 has to be in the german dd.mm.yyyy-notation. The input-variables datum1 and datum2 specify a date-range : datum1 - datum2

This method simplifies the notation of this range by subpressing redundant information. If the year is same in both variables it will only print once. same if year and month or even year and month and day are the same.

examples:

01.01.2010 - 01.02.2010 : 01.01. - 01.02.2010
01.01.2010 - 01.01.2011 : 01.01.2010 - 01.01.2011
01.01.2010 - 31.01.2010 : 01. - 31.01.2010
31.12.2010 - 01.01.2011 : 31.12.2010 - 01.01.2011
01.01.2010 - 01.01.2010 : 01.01.2010


The simplified range is returned as text

date_cmp

usage:

date_cmp(DATE1,DATE2)

the date-format can be in yyyy-m-d or d.m.yyyy

results:

compares two dates and return the following result:

date1>date2 : 1
date1<date2 : -1
date1=date2 : 0

tech description:

converts both dates to unix-epoche and perform a <=> operator on the numerical results

level_kat

usage:

level_kat(NAMESPACE,DB_KAT,DB-CONTENT)

namespace is like in get_data and db-kat contains the categories and db-content the related content.

results:

This method performs a sql-query over a set of two databases and returns a list in db.namespace that contains the name of the category, its description, the level of the categorie and the number of documents that belongs to this category. This method is for getting the content-list of textarchiv, forschungsnetzwerk-texte and wba-texte.

tech description:

it performs a left outer join and is grouping the results.

select k.kategorie,k.beschreibung,(position(' ' in k.kategorie)-1)/2 as level,count(d.oid) as num_textes from fn_kat k 
left outer join fn_dokumente d on (k.id=d.kategorie) 
group by k.kategorie,k.beschreibung 
order by replace(k.kategorie,' ','0');

OH-funcitons

this functions are designed especially for the online-historiographie

get_oh_zeitreisejahre

parameters:

none

returnvalue:

none

description:

performs a get_sql to retrieve a list with all occuring years in the zeitreisedatenbank and stores the structure in db.ohz as would do a get_data with namespace=ohz

sql-statement:

select jahr from oh_zeitreise group by jahr order by jahr

get_oh_rundgang

parameters:

sql-datenbank : oh_ausstellung_online oder oh_institutionen_online id : id des aktuellen eintrags which : -1 ... voriger eintrag, +1 ... nexter eintrag, 0 .. zufälliger eintrag

returnvalue:

id

description:

get the first,last,prev,next entry to a current entry.

note: always use the _online - database or a wrong id will be returned !!!

example:

[% id=cgi.urlparam.1 %]	
[% db=cgi.urlparam.0 %]	

   [% prev = get_oh_rundgang(db,id,-1) %]
   [% next = get_oh_rundgang(db,id,1) %]
   [% first = get_oh_rundgang(db,0,1) %]
   [% last = get_oh_rundgang(db,0,-1) %]
  [% rand = get_oh_rundgang(db,0,0) %]
http://sandbox.adulteducation.at/peter/oh_rundgang/oh_ausstellung_online/168

get_oh_zufallsjahr

parameters:

none

returnvalue:

zufälliges jahr aus der zeitreise

get_wm_navigation

parameters:

none

returnvalue:

array that contains the navigation for the “wiener moderne”

description:

The Wiener Moderne has a nested navigation that is accessible via the returned array.

Each chapter has the following structure:

[number of the chapter, name of the chapter, array of entries in this chapter, array of subchapters]

the subchapters follow the same structure and the entries have a structure like

[name of entry, id of entry]

please note that the returned array itself is the null-chapter (rootchapter) with a empty chapternumber and a empty name and the mainchapters of the wienermoderne are the subchapters of the rootchapter. example:

['','',undef,[
                   [1,'hauptk-1',[["text1",1],["text2",2]],[1,'subk-1',....
]

example for a tt2-template that prints all the navigation without any entries:


   [% wmn = get_wm_navigation() %]

   [% FOREACH val_l1 = wmn.3 %]
	[% val_l1.0 %] 	[% val_l1.1 %] ([% val_l1.2.size %]) <br>
        [% FOREACH val_l2 = val_l1.3 %]
	  [% val_l1.0 %].[% val_l2.0 %] 	[% val_l2.1 %]  ([% val_l2.2.size %]) <br>
            [% FOREACH val_l3 = val_l2.3 %]
	      [% val_l1.0 %].[% val_l2.0 %].[% val_l3.0 %] 	[% val_l3.1 %] ([% val_l3.2.size %]) <br>
            [% END %]	
          [% END %]	
    [% END %]	
                                   

STATISTIK_FUNCTIONS

stat_report_page

parameters:

the packed pages-field

returnvalue:

a hash H

H.total  ...  total number of pages
H.content_table .... 1  if report has a content_table
H.pages.0   ... page 0
H.pages.1  ... page 1
...

description:

unpacks the pages-field and return the total number of pages and every page

VOEV_FUNCTIONS

this functions are designed especially for the voev-homepage, which is designed as very autonmous module of the knowledgebase

get_voev_struct

parameters:

none

returnvalue:

description:

return a complex structure containing the whole menu (main+submenu) of the vöv-page

get_voev_relatives

parameters:

content of the relatives-field

returnvalue:

a list that contains a list of id and title of the related entries.

return.0   ... list of the first related page
return.0.0 ... id of the first related page
return.0.1 ... Titel of the first related page
return.11.0 ... if of the 12th related page

description:

The contentmanagers can fill the field “relatives” with a list of related pages. This function fetches the titles for this related pages from the database and returns a id and title in a suitable way.

Note that only existing pages are processed, so wrong entries in the related-page do not harm anyone :)

INTERNAL FUNCTIONS

this functions are not available in the templates (althought you can do nasty tricks if you are up to. The system is for developers and not fool-prooved ;)

Note that on all methods the first parameter is the Object which is of course not mentioned here.

luc

parameters:

value

returnvalue:

the converted value

description:

convert a value to uppercase and convert all german umlauts to the corresponding html-entities. On IE for mac umlauts are converted to their non-german representants. Ä=>AE cause IE/mac cannot show umlauts in drop-down-menues.

note that this function is heaviliy localized for german needs.

split_url

parameters:

url

returnvalue:

(template-path,param)

description:

splits a given url (path+parameter, not alias or sysvalue) into templatepath (including the name) and parameters. For this the local harddisk is scanned for appropriate templates.

replace_url

parameters:

text

returnvalue:

text

description:

replaces every url in a given text with html-code that makes this url linkable

pre_destroy

parameters:

<none>

returnvalue:

<none>

//description://

removes the subs defined in goldfisch::tt2::funcs from the object to avoid problems with garbagecollection and have working DESTROY under mod_perl to avoid memleaking. We dont use goldfisch::tt2::circ_ref here to save time. Of course you should use debug-circtest from time to time to check if no other subroutines make problems. Also note that while development Object-Destroy of goldfisch::tt2 writes a DESTROY-message to STDERR that should be found in apaches error-log on every call.




 
kb/templateengine/funktionen.txt · Last modified: 2011/02/02 16:05 by peter