Wiki username: Is your name in WikiNotation, e.g. PeterThoeny. When you create your own home page topic, you should use your WikiName for the topic name. Like that, your name will be linked automatically where ever it is used. Please create your home page in TWiki.Main, not any other TWiki web.
Note: When you write a WikiName of a user (your own or somebody else's) be sure to specify the Main web in front of the Wiki user name, e.g. write it as Main.wikiUsername. This assures that the name will be linked automatically to the TWiki.Main web, even if the text is written in a different Wiki web.
TWiki can map the Intranet username to the Wiki username automatically, provided that the Login username and Wiki username pair has been entered in the TWikiUsers topic.
(2) Wiki Variables
TWiki Variables
Text strings expanded on the fly to display data or system info
Overview
TWikiVariables are text strings - %VARIABLE% - that expand into content whenever a page is opened. Variables are replaced by their actual values: stored data, or system info (like the date, or the current user). There are predefined variables, and Preference variables that you set. You can also define custom variables, with new names and values.
Predefined Variables
Most predefined variables return values that were either defined when TWiki was installed, or taken from server info (like current username, or date and time). Many of the variables let you control how the formatted results appear.
netfrag.org expands the following variables (enclosed in % percent signs):
Variable:
Expanded to:
%WIKIHOMEURL%
The base script URL of netfrag.org, is the link of the Home icon in the upper left corner, is http://TWiki.org/
%SCRIPTURL%
The script URL of netfrag.org, is https://netfrag.org/twiki/bin
%SCRIPTURLPATH%
The path of the script URL of netfrag.org, is /twiki/bin
%SCRIPTSUFFIX%
The script suffix, ex: .pl, .cgi is
%PUBURL%
The public URL of TWiki, is https://netfrag.org/twiki/pub
%PUBURLPATH%
The path of the public URL of netfrag.org, is /twiki/pub
%ATTACHURL%
The attachment URL of the current topic, is https://netfrag.org/twiki/pub/TWiki/TWikiVariables Example: If you attach a file you can refer to it as %ATTACHURL%/image.gif
%ATTACHURLPATH%
The path of the attachment URL of the current topic, is /twiki/pub/TWiki/TWikiVariables
%URLPARAM{"name"}%
Returns the value of a URL parameter. Ex: %URLPARAM{"skin"}% returns print for a .../view/TWiki/TWikiVariables?skin=print URL. Is
%WIKITOOLNAME%
Name of wiki tool, is netfrag.org
%WIKIVERSION%
Wiki tool version is 04 Sep 2004 $Rev: 1742 $
%USERNAME%
Your login username is guest
%WIKINAME%
Your Wiki username. Same as %USERNAME% if not defined in the TWikiUsers topic. Is TWikiGuest
%WIKIUSERNAME%
Your %WIKINAME% including the Main web name. Usefull for signatures. Is Main.TWikiGuest
%MAINWEB%
The Main web containing TWikiUsers, OfficeLocations? and TWikiGroups?. Is Main
%TWIKIWEB%
The web containing all documentation and configuration of netfrag.org is TWiki
%WEB%
The current web is TWiki
%BASEWEB%
The web name where the includes started, e.g. the web of the first topic of nested includes. Same as %WEB% in case there is no include.
%INCLUDINGWEB%
The web name of the topic that includes the current topic. Same as %WEB% in case there is no include.
The index topic of all registered users. Is TWikiUsers
%WIKIPREFSTOPIC%
The web preferences topic. Is TWikiPreferences
%WEBPREFSTOPIC%
The web preferences topic. Is WebPreferences
%STATISTICSTOPIC%
The web statistics topic. Is WebStatistics
%TOPIC%
The current topic name, is TWikiVariables
%BASETOPIC%
The name of the topic where the includes started, e.g. the first topic of nested includes. Same as %TOPIC% in case there is no include.
%INCLUDINGTOPIC%
The name of the topic that includes the current topic. Same as %TOPIC% in case there is no include.
%SPACEDTOPIC%
The current topic name with added spaces, for regular expression search of Ref-By, is TWiki%20*Variables
%TOPICLIST{"format"}%
Topic index of a web. The "format" defines the format of one topic item. It may include variables: The $name variable gets expanded to the topic name; the $web variable gets expanded to the name of the web.
Parameters are format, separator and web:
Format of one line, may include $name and $web variables
"$name"
format="format"
(Alternative to above)
"$name"
separator=", "
line separator
"\n" (new line)
web="Name"
Name of web
Current web
Examples:
%TOPICLIST{" * $web.$name"}% creates a bullet list of all topics.
%TOPICLIST{separator=", "}% creates a comma separated list of all topics.
%TOPICLIST{" <option>$name</option>"}% creates an option list (for drop down menus).
%WEBLIST{"format"}%
Web index, e.g. list of all webs. Hidden webs are excluded, e.g. webs with a NOSEARCHALL=on preference variable. The "format" defines the format of one web item. The $name variable gets expanded to the name of the web, $qname gets expanded to double quoted name, $marker to marker where web matches selection.
Parameters are format, separator and web:
comma sep list of Web, public expands to all non-hidden
"public"
marker="selected"
Text for $marker where item matches selection, otherwise equals ""
"selected"
selection="%WEB%"
Current value to be selected in list
section="%WEB%"
Examples: %WEBLIST{" * [[$name.Home]]"}% creates a bullet list of all webs.
%WEBLIST{"" webs="Trash,public" selection="TWiki" separator=" "}% Dropdown of all public Webs + Trash Web, current Web highlighted.
Variables can be shortened to 3 characters. Example: %GMTIME{"$day $month, $year - $hour:$min:$sec"}% is 24 Nov, 2024 - 15:22:23
%SERVERTIME%
Server time, is 24 Nov 2024 - 16:22
%SERVERTIME{"format"}%
Formatted server time. Example: %SERVERTIME{"$hou:$min"}% is 16:22
%HTTP_HOST%
HTTP_HOST environment variable, is netfrag.org
%REMOTE_ADDR%
REMOTE_ADDR environment variable, is 3.138.124.28
%REMOTE_PORT%
REMOTE_PORT environment variable, is 26141
%REMOTE_USER%
REMOTE_USER environment variable, is
%INCLUDE{"page" ...}%
Server side include to IncludeTopicsAndWebPages. Parameters are page name, and an optional pattern="(reg-exp)". The page name is:
"SomeTopic"
The name of a topic located in the current web, i.e. %INCLUDE{"WebNotify"}%
"Web.Topic"
A topic in another web, i.e. %INCLUDE{"TWiki.TWikiWebsTable"}%
"http://..."
A full qualified URL, i.e. %INCLUDE{"http://twiki.org/"}%
%STARTINCLUDE%
If present in included topic, start to include text from this location up to the end, or up to the location of the %STOPINCLUDE% variable. A normal view of the topic shows everyting exept the %STARTINCLUDE% variable itself.
%STOPINCLUDE%
If present in included topic, stop to include text at this location and ignore the remaining text. A normal view of the topic shows everyting exept the %STOPINCLUDE% variable itself.
%TOC%
Table of Contents of current topic.
%TOC{"SomeTopic" ...}%
Table of Contents. Shows a TOC that is generated automatically based on headings of a topic. Headings in WikiSyntax ("---++ text") and HTML ("<h2>text<h2>") are taken into account. (But not "<H2>text</H2>", which can be used to exclude a heading from the TOC.) Parameters are topic name, web and depth:
What sort of search is required? "topicmoved" if search for a topic that may have been moved "parent" if searcing for topics that have a specific parent i.e. its children
required
web="%WEB%"
Wiki web to search: A web, a list of webs separated by whitespace, or all webs.
required
topic="%TOPIC%"
The topic the search relates to
required
title="Title"
Text the is pre-pended to any search results
required
Example: %METASEARCH{type="topicmoved" web="%WEB%" topic="%TOPIC%" title="This topic used to exist and was moved to: "}%, you may want to use this in WebTopicViewTemplate and WebTopicNonWikiTemplate %METASEARCH{type="parent" web="%WEB%" topic="%TOPIC%" title="Children: "}%
%VAR{"NAME" web="Web"}%
Get a preference value from a web other then the current one. Example: To get %WEBBGCOLOR% of the Main web write %VAR{"WEBBGCOLOR" web="Main"}%, is #444444
[1] Note: The search form uses identical names for input fields.
[2] Note: A web can be excluded from a web="all" search if you define a NOSEARCHALL=on variable in its WebPreferences.
Preferences Variables
Additional variables are defined in the preferences ( site-level ( SL ) in TWikiPreferences, web-level ( WL ) in WebPreferences of each web, and user level ( UL ) preferences in individual user topics):
Variable:
Level:
What:
%WIKIWEBMASTER%
SL
Webmaster email address (sender of email notifications) , is webmaster@netfrag.org
%WIKIWEBLIST%
SL
List of netfrag.org webs (in upper right corner of topics)
%WEBTOPICLIST%
WL
Common links of web (second line of topics)
%WEBCOPYRIGHT%
SL , WL
Copyright notice (bottom right corner of topics)
%WEBBGCOLOR%
WL
Background color of web
%NOSEARCHALL%
WL
Exclude web from a web="all" search (set variable to on for hidden webs)
%NEWTOPICBGCOLOR%
SL , UL
Background color of non existing topic. ( UL needs authentication for topic views )
%NEWTOPICFONTCOLOR%
SL , UL
Font color of non existing topic. ( UL needs authentication for topic views )
%EDITBOXWIDTH%
SL , UL
Horizontal size of edit box, is 100
%EDITBOXHEIGHT%
SL , UL
Vertical size of edit box, is 20
%RELEASEEDITLOCKCHECKBOX%
SL , UL
Default state of the "Release edit lock" (UnlockTopic) check box in preview. Checkbox is initially checked if Set RELEASEEDITLOCKCHECKBOX = checked="checked", or unchecked if empty. If checked, make sure to click on Edit to do more changes; do not go back in your browser to the edit page, or you risk that someone else will edit the topic at the same time! Value is: checked
%DONTNOTIFYCHECKBOX%
SL , UL
Default state of the "Minor Changes, Don't Notify" (DontNotify) check box in preview. Check box is initially checked if Set DONTNOTIFYCHECKBOX = checked="checked", or unchecked if empty. Value is: checked
%ATTACHLINKBOX%
SL , UL
Default state of the link check box in the attach file page. Check box is initially checked if value is set to CHECKED , unchecked if empty. If checked, a link is created to the attached file at the end of the topic. Value is:
%HTTP_EQUIV_ON_VIEW%
SL
http-equiv meta tags for view, rdiff, attach, search* scripts.
%HTTP_EQUIV_ON_EDIT%
SL , UL
http-equiv meta tags for edit script.
%HTTP_EQUIV_ON_PREVIEW%
SL , UL
http-equiv meta tags for preview script.
%DENYWEBCHANGE%
WL
List of users and groups who are not allowed to change topics in the netfrag.org web. (More in TWikiAccessControl)
%ALLOWWEBCHANGE%
WL
List of users and groups who are allowed to change topics in the netfrag.org web. (More in TWikiAccessControl)
%DENYTOPICCHANGE%
(any topic)
List of users and groups who are not allowed to change the current topic. (More in TWikiAccessControl)
%ALLOWTOPICCHANGE%
(any topic)
List of users and groups who are allowed to change the current topic. (More in TWikiAccessControl)
%DENYWEBRENAME%
WL
List of users and groups who are not allowed to rename topics in the netfrag.org web. (More in TWikiAccessControl)
%ALLOWWEBRENAME%
WL
List of users and groups who are allowed to rename topics in the netfrag.org web. (More in TWikiAccessControl)
%DENYTOPICRENAME%
(any topic)
List of users and groups who are not allowed to rename the current topic. (More in TWikiAccessControl)
%ALLOWTOPICRENAME%
(any topic)
List of users and groups who are allowed to rename the current topic. (More in TWikiAccessControl)
%FINALPREFERENCES%
SL , WL
List of preferences that are not allowed to be overridden by next level preferences
Setting Preferences
The syntax for Preferences variables is the same anywhere in TWiki. In Edit mode, from the start of a new line: [6 spaces] * [space] Set [space] VARIABLENAME [space] = [value] Example:
Set VARIABLENAME = value
Creating Custom Variables
You can add your own preference variables for an entire site, a single web, or a single topic, using the standard syntax. Whatever you include in your variable will be expanded on display, and treated exactly as if it had been written out. So you can place formatted text, page links, image paths.
Example: Create a custom logo variable
To place a logo anywhere in a web by typing %MYLOGO%, simply define the variable on the web's WebPreferences page. You also have to upload logo.gif - this can be done by attaching a file to LogoTopic (any topic name you choose):
Set MYLOGO = %PUBURL%/%MAINWEB%/LogoTopic/logo.gif
Above template files will result in the following table when editing a topic:
Note: It is possible to force the values of a category table when creating a new topic. This is useful to create new topics using a form for the topic name. The default values of the category table can be specified as hidden fields if needed, i.e. <input type="hidden" name="someCategory" value="someValue">
Example (edit this page to see the source) :
Create directory /home/httpd/twiki and unzip the TWiki distribution to this directory.
The twiki/bin directory of TWiki must be set as a cgi-bin directory. Add /home/httpd/twiki/bin to /etc/httpd/conf/access.conf with only ExecCGI option.
The twiki/pub directory of TWiki must be set so that it is visible as a URL. Add /home/httpd/twiki/pub to /etc/httpd/conf/access.conf with normal access options (copy from /home/httpd/html).
Now add Alias for /twiki/pub and ScriptAlias for /twiki/bin to /etc/httpd/conf/srm-conf .
Restart Apache by /etc/rc.d/rc5.d/S85httpd restart .
Test if the twiki/bin directory is cgi-enabled:
Enter the URL of that directory into your browser ( http://your.domain.com/twiki/bin ). It is not set correctly as cgi-bin in case you get something like "Index of /twiki/bin" . It is OK if you get a message like "Forbidden. You don't have permission to access /twiki/bin/ on this server."
Execute the testenv script from your browser ( http://your.domain.com/twiki/bin/testenv ). It should show a table of all CGI environment variables.
Make sure PERL and the PERL CGI library is installed on your system. Default location of PERL executable is /usr/bin/perl . In case PERL is installed in a different location, the first line of all perl scripts in the twiki/bin directory need to be changed (alternatively you can create a symbolic link from /usr/bin/perl ).
To be able to edit the perl scripts and .tmpl files it is necessary to chown and chgrp -R twiki so all the files have the owner you want.
The scripts execute as nobody . Set the file permission of all Perl scripts in the twiki/bin directory as executable to -rw-r-xr-x .
Set the file permission of all files below twiki/data to 666 ( -rw-rw-rw- ).
Set the file permission of the twiki/data directory and all its subdirectories to 777 ( drwxrwxrwx ).
Set the file permission of the twiki/pub directory to 777 ( drwxrwxrwx ).
Edit the file twiki/bin/wikicfg.pm and set the variables at the beginning of the file to your needs.
Make sure RCS is installed. In case RCS is not in the path environment variable, add it to path . Alternatively, add the full path name to the rcs, ci, co, rlog, rcsdiff commands in the variables of twiki/bin/wikicfg.pm .
Note in case cgi user is notnobody : The *,v RCS repository files delivered with the installation package are locked by user nobody . In case the user is different (e.g. www-data ), it is not possible to check in files, this has the effect that the topic version number does not increase when saving a topic. In this case you need to unlock all repository files and lock them as user www-data (check the rcs man pages), or simply delete all the repository files.
Security issue: Directories twiki/data , twiki/templates and all its subdirectories should be set so that they are not visible as a URL. (Alternatively, move the directries to a place where they are not visible, and change the variables in twiki/bin/wikicfg.pm accordingly)
Enable email notification of topic changes, (3) has more.
Optional: You can add new rendering rules or new %variables%. To insure an easy upgrade of TWiki it is recommended to do this customization in twiki/bin/wikicfg.pm , not twiki/bin/wiki.pm .
Optional: If you are on a public server and you would like to authenticate users you need to rename file .htaccess.txt in the twiki/bin directory to .htaccess and change it to your needs. For details consult the HTTP server documentation (for Apache server: [1], [2], [3]). Note: In case .htaccess does not have any effect you need to enable it: Add "AllowOverride All" to the Directory section of access.conf for your twiki/bin directory.
Optional: You can automatically generate usage statistics for all webs. To enable this:
Make sure variable $doLogTopicView, $doLogTopicSave and $doLogTopicUpload in wikicfg.pm are set. This will generate log entries in file twiki/data/log<date>.txt .
Topic WebStatistics must be present in all webs where you want to have statistics. You can use the topic in the Main web as a template.
Call the twiki/bin/statistics script from a cron job, once a day is recommended. This will update the WebStatistics topics in all webs.
Attention: The script must run as the same user as the CGI scripts are running, which is user nobody on most systems. Example crontab entry: 0 0 * * * (cd /path/to/TWiki/bin; ./statistics >/dev/null 2>&1)
There is a workaround in case you can't run the script as user nobody : Run the utility twiki/bin/geturl in your cron job and specify the URL of the twiki/bin/statistics script as a parameter. Example: 0 0 * * * (cd /path/to/TWiki/bin; ./geturl mydomain.com /urlpath/to/TWiki/bin/statistics >/dev/null 2>&1)
The twiki/bin/statistics script can also be executed as a CGI script, just enter the URL in your browser. Examples:
Update current month for all webs: http://mydomain.com/twiki/bin/statistics
Update current month for Main web only: http://mydomain.com/twiki/bin/statistics/Main
Update January 2000 for Main web: http://mydomain.com/twiki/bin/statistics/Main?logdate=200001
To create a new web:
Use a name for the web consisting of characters A..Z , a..z but not in WikiNotation.
Create a new template directory under twiki/templates .
Create a new data directory under twiki/data and check the file permission of the directory.
Copy the files WebHome.txt , WebPreferences.txt , WebNotify.txt , WebSearch.txt and WebStatistics.txt from the twiki/data/Main directory to the new data directory, preserving the original files' owner, group and permissions ( on Unix use cp -p ). The data files must be writable by the owner the CGI scripts are running on ( usually nobody ). Hint: You can set permissions of .txt and .txt,v files to -rw-rw-rw- and then edit the topic using your browser, RCS will restore the file permission correctly when saving the topic.
Add the new web to the web list (on top of each topic) by editing the site-level preferences TWikiPreferences?:
Add the new web to the WIKIWEBLIST variable.
Add the new web to the web table (at the bottom of each WebHome topic) by editing the TWikiWebsTable? topic.
Change the web preferences by editing the WebPreferences topic of the new web:
Set the WEBBGCOLOR variable to a color of your taste. The number represents the unique color for the web (consult an HTML book for colors.)
Customize the WEBTOPICLIST variable to contain the web specific links you prefer.
Optional: Set the WEBCOPYRIGHT variable to have a web-specific copyright text (at the bottom of each topic).
If needed, create customized templates in the new templates directory. (Non existing templates are inherited from twiki/templates )
If you want to use a category table, copy the three files twikicatitems.tmpl , twikicatedit.tmpl and twikicatview.tmpl from the twiki/templates/Know directory to the new templates directory, and customize it. The TWiki Category Table section has more.
In case you want usage statistics for this web: Copy file WebStatistics.txt from the twiki/data/Main directory to the new data directory. Edit topic WebStatistics in the new web and delete old usage entries.
Here are contents of directories with file permissions. Please note that this is for debugging reasons only and does not exactly reflect the distribution:
directory twiki/bin :
drwxr-xr-x 2 twiki twiki 1024 Feb 18 18:31 .
drwxr-xr-x 8 twiki twiki 1024 Feb 26 04:20 ..
-rw-rw-r-- 1 twiki twiki 770 Feb 10 12:10 .htaccess
-rw-r-xr-x 1 twiki twiki 3968 Feb 18 00:26 attach
-rwxr-xr-x 1 twiki twiki 3033 Feb 17 23:57 changes
-rw-r-xr-x 1 twiki twiki 1377 Feb 8 18:18 delete
-rw-r-xr-x 1 twiki twiki 8785 Feb 17 23:58 edit
-rwxr--r-- 1 twiki twiki 1811 Feb 4 14:31 geturl
-rwxr-xr-x 1 twiki twiki 5047 Feb 8 20:33 mailnotify
-rw-r-xr-x 1 twiki twiki 1825 Feb 8 18:29 oops
-rw-r-xr-x 1 twiki twiki 6932 Feb 11 02:06 preview
-rw-r-xr-x 1 twiki twiki 7804 Feb 17 23:59 rdiff
-rw-r-xr-x 1 twiki twiki 7010 Feb 18 00:03 register
-rw-r-xr-x 1 twiki twiki 2501 Jan 25 19:39 save
-rwxr-xr-x 1 twiki twiki 1778 Feb 18 00:04 search
-rw-r-xr-x 1 twiki twiki 9810 Feb 8 18:43 statistics
-rwxr-xr-x 1 twiki twiki 509 Feb 7 18:55 testenv
-rw-r-xr-x 1 twiki twiki 6856 Feb 18 00:11 upload
-rw-r-xr-x 1 twiki twiki 4922 Feb 17 23:54 view
-rw-r-xr-x 1 twiki twiki 1606 May 21 1999 viewfile
-rw-r-xr-x 1 twiki twiki 27794 Feb 26 06:03 wiki.pm
-rw-r-xr-x 1 twiki twiki 10143 Feb 27 04:03 wikicfg.pm
-rw-r-xr-x 1 twiki twiki 5440 Feb 7 04:36 wikisearch.pm
directory twiki/templates/ :
drwxr-xr-x 7 twiki twiki 1024 Jan 16 19:39 .
drwxr-xr-x 8 twiki twiki 1024 Feb 26 04:20 ..
drwxr-xr-x 2 twiki twiki 1024 Jun 8 1999 Know
drwxr-xr-x 2 twiki twiki 1024 Dec 9 1998 Main
-rw-r--r-- 1 twiki twiki 2286 Feb 24 21:50 attach.tmpl
-rw-r--r-- 1 twiki twiki 1272 Feb 8 16:07 attachtable.tmpl
-rw-r--r-- 1 twiki twiki 1884 Feb 24 21:54 changes.tmpl
-rw-r--r-- 1 twiki twiki 2242 Feb 24 21:33 edit.tmpl
-rw-r--r-- 1 twiki twiki 965 Feb 8 16:07 mailnotify.tmpl
-rw-r--r-- 1 twiki twiki 30 Jan 14 1999 notedited.tmpl
-rw-r--r-- 1 twiki twiki 934 Feb 8 16:07 notext.tmpl
-rw-r--r-- 1 twiki twiki 899 Feb 8 16:07 notwiki.tmpl
-rw-r--r-- 1 twiki twiki 299 Feb 24 21:58 noweb.tmpl
-rw-r--r-- 1 twiki twiki 957 Feb 24 22:17 oops.tmpl
-rw-r--r-- 1 twiki twiki 871 Feb 24 22:17 oopsdel.tmpl
-rw-r--r-- 1 twiki twiki 1330 Feb 24 22:17 oopslocked.tmpl
-rw-r--r-- 1 twiki twiki 1024 Feb 24 22:17 oopsregexist.tmpl
-rw-r--r-- 1 twiki twiki 912 Feb 24 22:17 oopsregpasswd.tmpl
-rw-r--r-- 1 twiki twiki 923 Feb 24 22:17 oopsregrequ.tmpl
-rw-r--r-- 1 twiki twiki 1125 Feb 24 22:17 oopsregthanks.tmpl
-rw-r--r-- 1 twiki twiki 942 Feb 24 22:17 oopsregwiki.tmpl
-rw-r--r-- 1 twiki twiki 1564 Feb 24 22:17 oopsrev.tmpl
-rw-r--r-- 1 twiki twiki 906 Feb 24 22:17 oopsupload.tmpl
-rw-r--r-- 1 twiki twiki 1535 Feb 24 22:02 preview.tmpl
-rw-r--r-- 1 twiki twiki 1661 Feb 24 22:04 rdiff.tmpl
-rw-r--r-- 1 twiki twiki 263 Aug 3 1999 register.tmpl
-rw-r--r-- 1 twiki twiki 936 Feb 8 16:08 registernotify.tmpl
-rw-r--r-- 1 twiki twiki 1779 Feb 24 22:06 search.tmpl
-rw-r--r-- 1 twiki twiki 1533 Feb 24 21:43 view.tmpl
directory twiki/templates/Main :
drwxr-xr-x 2 twiki twiki 1024 Dec 9 1998 .
drwxr-xr-x 7 twiki twiki 1024 Jan 16 19:39 ..
-rw-r--r-- 1 twiki twiki 2732 Feb 24 21:34 edit.tmpl
directory twiki/templates/Know (has a TWiki Category Table) :