TWiki Reference Manual (Foswiki-1.0.4, Thu, 19 Mar 2009, build 3201)
This page contains all documentation topics as one long, complete reference sheet.
Related Topics: TWikiSite,
TWikiHistory,
TWikiPlannedFeatures,
TWikiEnhancementRequests,
UserDocumentationCategory,
AdminDocumentationCategory
TWiki System Requirements
Server and client requirements
Low client and server base requirements are core features that keep TWiki widely deployable, particularly across a range of browser platforms and versions. Many
Plugins and
contrib modules exist which enhance and expand TWiki's capabilities; they may have additional requirements.
- TWiki System Requirements
- TWiki Installation Guide
- TWiki Upgrade Guide
- Wiki User Authentication
- Wiki Access Control
- Raw Edit Formatting or Wiki Text Formatting
- Wiki Variables
- TWiki Formatted Search
- File Attachments
- TWiki Forms
- TWiki Templates
- TWiki Skins
- TWiki Meta Data
- TWiki Add-Ons
- TWiki Contribs
- TWiki Plugins
- Overview
- Installing Plugins
- Managing Installed Plugins
- The TWiki Plugin API
- Creating Plugins
- Recommended Storage of Plugin Specific Data
- Integrating with
configure
- Maintaining Plugins
- Environment
- Preferences
- User Handling and Access Control
- Webs, Topics and Attachments
- getListOfWebs( $filter ) -> @webs
- webExists( $web ) -> $boolean
- createWeb( $newWeb, $baseWeb, $opts )
- moveWeb( $oldName, $newName )
- eachChangeSince($web, $time) -> $iterator
- getTopicList( $web ) -> @topics
- topicExists( $web, $topic ) -> $boolean
- checkTopicEditLock( $web, $topic, $script ) -> ( $oopsUrl, $loginName, $unlockTime )
- setTopicEditLock( $web, $topic, $lock )
- saveTopic( $web, $topic, $meta, $text, $options ) -> $error
- saveTopicText( $web, $topic, $text, $ignorePermissions, $dontNotify ) -> $oopsUrl
- moveTopic( $web, $topic, $newWeb, $newTopic )
- getRevisionInfo($web, $topic, $rev, $attachment ) -> ( $date, $user, $rev, $comment )
- getRevisionAtTime( $web, $topic, $time ) -> $rev
- readTopic( $web, $topic, $rev ) -> ( $meta, $text )
- readTopicText( $web, $topic, $rev, $ignorePermissions ) -> $text
- attachmentExists( $web, $topic, $attachment ) -> $boolean
- readAttachment( $web, $topic, $name, $rev ) -> $data
- saveAttachment( $web, $topic, $attachment, $opts )
- moveAttachment( $web, $topic, $attachment, $newWeb, $newTopic, $newAttachment )
- Assembling Pages
- readTemplate( $name, $skin ) -> $text
- loadTemplate ( $name, $skin, $web ) -> $text
- expandTemplate( $def ) -> $string
- writeHeader( $query, $contentLength )
- redirectCgiQuery( $query, $url, $passthru )
- addToHEAD( $id, $header )
- expandCommonVariables( $text, $topic, $web, $meta ) -> $text
- renderText( $text, $web ) -> $text
- internalLink( $pre, $web, $topic, $label, $anchor, $createLink ) -> $text
- E-mail
- Creating New Topics
- Special handlers
- Searching
- Plugin-specific file handling
- General Utilities
- StaticMethod sanitizeAttachmentName ($fname) -> ($fileName,$origName)
- Deprecated functions
- TWiki CGI and Command Line Scripts
- TWiki Site Tools
- Managing Topics
- Managing Webs
- Manage Users
- Appendix A: TWiki Development Time-line
- Appendix B: Encode URLs With UTF8
- Appendix C: TWiki CSS
Server Requirements
TWiki is written in Perl 5, uses a number of shell commands, and requires
RCS (Revision Control System), a GNU Free Software package. TWiki is developed in a basic Linux/Apache environment. It also works with Microsoft Windows, and should have no problem on any other platform that meets the requirements.
Resource |
Required Server Environment * |
Perl |
5.6.1 or higher (5.8.4 or higher is recommended) |
RCS |
5.7 or higher (including GNU diff ) Optional, TWiki includes a pure perl implementation of RCS that can be used instead (although it's slower) |
GNU diff |
GNU diff 2.7 or higher is required when not using the all-Perl RcsLite. Install on PATH if not included with RCS (check version with diff -v ) Must be the version used by RCS, to avoid problems with binary attachments - RCS may have hard-coded path to diff |
GNU patch |
For upgrades only: GNU patch is required when using the TWiki:Codev.UpgradeTWiki script |
GNU fgrep , egrep |
Modify command line parameters in configure if you use non-GNU grep programs |
Cron/scheduler |
• Unix: cron • Windows: cron equivalents |
Web server |
Apache is well supported; see TWiki:TWiki.InstallingTWiki#OtherWebServers for other servers |
Required CPAN Modules
The following Perl modules are used by TWiki:
Module |
Preferred version |
Algorithm::Diff (included) |
|
CGI::Carp |
>=1.26 |
Config |
>=0 |
Cwd |
>=3.05 |
Data::Dumper |
>=2.121 |
Error (included) |
|
File::Copy |
>=2.06 |
File::Find |
>=1.05 |
File::Spec |
>=3.05 |
File::Temp |
(included with perl 5.6 and later) |
FileHandle |
>=2.01 |
IO::File |
>=1.10 |
Text::Diff (included) |
|
Time::Local |
>=1.11 |
Optional CPAN Modules
The following Perl modules may be used by TWiki:
Module |
Preferred version |
Description |
CGI::Cookie |
>=1.24 |
Used for session support |
CGI::Session |
>=3.95 |
Used for session support |
Digest::base |
|
|
Digest::SHA1 |
|
|
Jcode |
|
Used for I18N support with perl 5.6 |
Locale::Maketext::Lexicon |
>=0 |
Used for I18N support |
Net::SMTP |
>=2.29 |
Used for sending mail |
Unicode::Map |
|
Used for I18N support with perl 5.6 |
Unicode::Map8 |
|
Used for I18N support with perl 5.6 |
Unicode::MapUTF8 |
|
Used for I18N support with perl 5.6 |
Unicode::String |
|
Used for I18N support with perl 5.6 |
URI |
|
Used for configure |
Most of them will probably already be available in your installation. You can check version numbers with the
configure
script, or if you're still trying to get to that point, check from the command line like this:
perl -e 'use FileHandle; print $FileHandle::VERSION."\n"'
Client Requirements
The TWiki
standard installation has relatively low browser requirements:
- HTML 3.2 compliant
- Cookies, if persistent sessions are required
CSS and Javascript are used in most skins, although there is a low-fat skin (Classic skin) available that minimises these requirements. Some skins will require more recent releases of browsers. The default skin (Pattern) is tested on IE 6, Safari, and Mozilla 5.0 based browsers (such as Firefox).
You can easily select a balance of browser capability versus look and feel. Try the installed skins at
TWikiSkinBrowser and more at
TWiki:Plugins.SkinPackage.
Important note about TWiki Plugins
- Plugins can require just about anything - browser-specific functions, stylesheets (CSS), Java applets, cookies, specific Perl modules,... - check the individual Plugin specs.
Related Topics: AdminDocumentationCategory
Back to top
TWiki Installation Guide
The following is installation instructions for the TWiki 4.2 production release on an Apache web server on Linux. Visit
TWiki:TWiki.InstallingTWiki for the latest updates to this guide and supplemental information for installing or upgrading TWiki, including notes on installing TWiki on different platforms, environments and web hosting sites.
If you are upgrading from a previous version of TWiki, you probably want to read
TWikiUpgradeGuide
instead.
Both this document and the TWikiUpgradeGuide are also available in the root of the distribution as HTML files. For this reason links to pages inside your own TWiki are written like
TWiki.WebHome
and not like live web links.
- TWiki System Requirements
- TWiki Installation Guide
- TWiki Upgrade Guide
- Wiki User Authentication
- Wiki Access Control
- Raw Edit Formatting or Wiki Text Formatting
- Wiki Variables
- TWiki Formatted Search
- File Attachments
- TWiki Forms
- TWiki Templates
- TWiki Skins
- TWiki Meta Data
- TWiki Add-Ons
- TWiki Contribs
- TWiki Plugins
- Overview
- Installing Plugins
- Managing Installed Plugins
- The TWiki Plugin API
- Creating Plugins
- Recommended Storage of Plugin Specific Data
- Integrating with
configure
- Maintaining Plugins
- Environment
- Preferences
- User Handling and Access Control
- Webs, Topics and Attachments
- getListOfWebs( $filter ) -> @webs
- webExists( $web ) -> $boolean
- createWeb( $newWeb, $baseWeb, $opts )
- moveWeb( $oldName, $newName )
- eachChangeSince($web, $time) -> $iterator
- getTopicList( $web ) -> @topics
- topicExists( $web, $topic ) -> $boolean
- checkTopicEditLock( $web, $topic, $script ) -> ( $oopsUrl, $loginName, $unlockTime )
- setTopicEditLock( $web, $topic, $lock )
- saveTopic( $web, $topic, $meta, $text, $options ) -> $error
- saveTopicText( $web, $topic, $text, $ignorePermissions, $dontNotify ) -> $oopsUrl
- moveTopic( $web, $topic, $newWeb, $newTopic )
- getRevisionInfo($web, $topic, $rev, $attachment ) -> ( $date, $user, $rev, $comment )
- getRevisionAtTime( $web, $topic, $time ) -> $rev
- readTopic( $web, $topic, $rev ) -> ( $meta, $text )
- readTopicText( $web, $topic, $rev, $ignorePermissions ) -> $text
- attachmentExists( $web, $topic, $attachment ) -> $boolean
- readAttachment( $web, $topic, $name, $rev ) -> $data
- saveAttachment( $web, $topic, $attachment, $opts )
- moveAttachment( $web, $topic, $attachment, $newWeb, $newTopic, $newAttachment )
- Assembling Pages
- readTemplate( $name, $skin ) -> $text
- loadTemplate ( $name, $skin, $web ) -> $text
- expandTemplate( $def ) -> $string
- writeHeader( $query, $contentLength )
- redirectCgiQuery( $query, $url, $passthru )
- addToHEAD( $id, $header )
- expandCommonVariables( $text, $topic, $web, $meta ) -> $text
- renderText( $text, $web ) -> $text
- internalLink( $pre, $web, $topic, $label, $anchor, $createLink ) -> $text
- E-mail
- Creating New Topics
- Special handlers
- Searching
- Plugin-specific file handling
- General Utilities
- StaticMethod sanitizeAttachmentName ($fname) -> ($fileName,$origName)
- Deprecated functions
- TWiki CGI and Command Line Scripts
- TWiki Site Tools
- Managing Topics
- Managing Webs
- Manage Users
- Appendix A: TWiki Development Time-line
- Appendix B: Encode URLs With UTF8
- Appendix C: TWiki CSS
Preparing to install TWiki
Before attempting to install TWiki, you are encouraged to review the
TWiki:TWiki.AdminSkillsAssumptions. This guide assumes the person installing TWiki has, at a minimum, basic knowledge of server administration on the system on which TWiki is to be installed. While it is possible to install TWiki with FTP access alone (for example, on a hosted site), it is tricky and may require additional support from your hosting service (for example, in setting file ownership and installing missing perl CPAN libraries).
To help setup a correct Apache configuration, you are very much encouraged to use the automatic tool
TWiki:TWiki.ApacheConfigGenerator which generates the contents for an Apache config file for TWiki based on your inputs.
While this installation guide specifically describes installation on an Apache web server on Linux, TWiki should be fine with any web server and OS that meet the system requirements (see below). For additional notes on installing TWiki on other systems, see
TWiki:TWiki.InstallingTWiki#OtherPlatforms.
If you are installing TWiki without Unix/Linux root (administrator) priviledges (for example, on a hosted domain), see "Notes on Installing TWiki on Non-Root Account" below for supplemental instructions to the basic steps presented below.
If you are upgrading from an earlier major version of TWiki such as Cairo (TWiki 3) you will need the information found in
TWiki:TWiki.TWikiUpgradeGuide. There is also a static HTML
TWikiUpgradeGuide.html
included in the root of your TWiki distribution.
Upgrading from a recent TWiki4 release is much simpler. Upgraders from earlier TWiki4 versions can follow the steps described in
TWiki:TWiki.UpgradingTWiki04x00PatchReleases to ensure a safe upgrade without accidently overwriting customizations.
One of the more difficult tasks is installation of addition CPAN libraries. See
TWiki:TWiki.HowToInstallCpanModules for detailed information on how to install CPAN libraries.
If you need help, ask a question in the
TWiki:Support web or on
TWiki:Codev.TWikiIRC (irc.freenode.net, channel #twiki)
Basic Installation
- Download the TWiki distribution from http://TWiki.org/download.html.
- Make a directory for the installation and unpack the distribution in it. In the rest of this document we assume this directory is called
twiki
.
- Note! that TWiki does not allow spaces in the directory names. Especially on Windows make sure to use a directory path without spaces.
- Setup access file and directory rights to enable the webserver user (the user Apache runs the CGI scripts as) to read and write inside the twiki directory.
- Warning! Do not just just run a
chmod -R 770 twiki
. The access rules have different meaning for files and directories. This is the most common mistake installers make.
- The distribution tgz has the file and directory access rights setup to work with a reasonable security level that will work for all types of installations including shared hosting.
- The ownership of the twiki directory tree is normally set to the user that unpacked the tgz and will have to be changed to the webserver user using the command
chown -R user:group /path/to/twiki
. The webserver username varies from Distributions. Examples for some major distributions:
- RedHat, Fedora, CentOS, Gentoo, Mandriva :
chown -R apache:apache /path/to/twiki
- debian/Ubuntu/Kubunto :
chown -R www-data:www-data /path/to/twiki
- Suse :
chown -R wwwrun:www /path/to/twiki
- If you mistakenly change the access rights in a way that makes TWiki stop working, simply run the script found at TWiki:TWiki.SettingFileAccessRightsLinuxUnix to set the access right of the entire TWiki tree back to the distributed defaults.
- It is possible to define tighter access rules than the ones given by default after the installation is complete. But how tight they should be depends on your distribution and local needs. Typically you may want to limit all access from world if the webserver machine has login access for other users than root and the web server administrator. For a dedicated web server made just for running TWiki with limited login access the default access rights have a good safety level.
- Check the Perl installation. Ensure that Perl 5 and the Perl CGI library are installed on your system.
- The default location of Perl is
/usr/bin/perl
. If it's somewhere else, change the path to Perl in the first line of each script in the twiki/bin
directory.
- Some systems require a special extension on perl scripts (e.g.
.cgi
or .pl
). This is normally only needed under Windows and only where perl scripts are only recognized by file extension. Linux and Unix users should normally never need to do this. If necessary, rename all files in twiki/bin
(i.e. rename view
to view.pl
etc). If you do this, make sure you set the ScriptSuffix
option in configure
(Step 6).
- Create the file LocalLib.cfg located as
twiki/bin/LocalLib.cfg
- There is a template for this file in
twiki/bin/LocalLib.cfg.txt
. Simply copy LocalLib?.cfg.txt to LocalLib?.cfg. Make sure the ownership and access rights of the copy are the same as LocalLib?.cfg.txt
- The file
twiki/bin/LocalLib.cfg
must contain a setting for $twikiLibPath
, which must point to the absolute file path of your twiki/lib
e.g. /var/www/twiki/lib
.
- If you need to install additional CPAN modules, but can't update the main Perl installation files on the server, you can set
$CPANBASE
to point to your personal CPAN install. Don't forget that the webserver user has to be able to read those files as well.
- Choose best configuration method for your webserver. There are two ways to configure Apache: config file included from httpd.conf or .htaccess files
- Apache config file: The recommended method is using a config file. With a config file you can put the entire TWiki configuration in ONE file (typically named
twiki.conf
). Performance is much better with a config file, and one file gives the best overview and ensures that you get a safe installation . However using a config file requires that you can restart Apache which again means that you need root or sudo access to stop and start Apache. The TWiki apache config file is included from the main Apache config file http.conf. Most distributions have a directory from which any file that ends with .conf
gets included when you restart Apache (Example RedHat/Fedora/Centos: /etc/httpd/conf.d). If you use a virtual host setup in Apache you should include the twiki.conf file from inside the desired virtual host config in your Apache configuration.
- .htaccess file: This should only be used when you cannot use a config file. Performance is slowed down because Apache has to look through all directories in search for possible .htaccess files each time someone views a page in TWiki. Normally this is the only way to control Apache in a shared host environment where you have no root or sudo priviledges.
- Configure the webserver
- Unless you are an Apache expert setting up the webserver can be quite difficult. But TWiki has three resources that make setting up Apache easier.
- The best and easiest way is to use webpage TWiki:TWiki.ApacheConfigGenerator which contains a tool that can generate a safe and working config file for TWiki on Apache.
- In the root of the twiki installation you find an example config file
twiki_httpd_conf.txt
- In the root of the twiki installation and in the
twiki/bin
directory you find example .htaccess
files you can copy and modify. The files contains help text explaining how to set them up. In twiki/bin
you find .htaccess.txt
which can be copied to .htaccess
and defined access to the CGI scripts. In the root of TWiki you find pub-htaccess.txt
which you can copy to pub/.htaccess
, subdir-htaccess.txt
which you can copy to all directories as .htaccess
except bin and pub, and you find root-htaccess.txt
which you can copy to .htaccess
in the twiki root directory. But again only use .htaccess files if you do not have root priviledges.
- If you are unsure about how to do this on your system, see TWiki:TWiki.InstallingTWiki#OtherPlatforms for links to information about various server setups.
- Note! When you use config files you need to restart Apache each time you change a setting to make the new setting active.
- Protect the configure script
- You should never leave the
configure
script open to the public. Limit access to the twiki/bin/configure
script to either localhost, an IP address or a specific user using basic Apache authentication. The TWiki:TWiki.ApacheConfigGenerator lets you setup who has access to the configure script. Also the example twiki-httpd-conf.txt and bin/.htaccess.txt files includes the needed setting to protect the configure script.
- If you limit the access to a particular user then you need to setup a .htpasswd file that contains the user name and password that Apache will authenticate against. Per default both TWiki:TWiki.ApacheConfigGenerator and the example config files and .htaccess files uses
twiki/data/.htpasswd
but this file does not exist until you have TWiki running and have registered the first user. You therefore have two options. Either limit the access to localhost or an IP address, or make a .htpasswd file. To make a .htpasswd file change directory to twiki/data
and issue the command htpasswd -c .htpasswd username
and enter your password when asked. The username must match the Require user username
directive in the Apache config file or .htaccess file. Do not use a username you will later use to register in TWiki because TWiki will then claim that you are already registered.
- Run the
configure
script from your browser (enter http://yourdomain/twiki/bin/configure
into your browser address bar)
- Resolve any errors or warnings it tells you about.
- Note! When you run
configure
for the first time, you can only edit the section General Path Settings
. Save these settings, and then return to configure
to continue configuration.
- If your webserver can be accessed by more than one domain name make sure to add the additional alternative URLs to
{PermittedRedirectHostUrls}
- When you return to configure you now need to setup Mail and Proxies. Especially the
{WebMasterEmail}
, and {SMTP}{MAILHOST}
must be defined to enable TWiki to send registration emails. Many ISPs have introduced authentication when sending emails to fight spam so you may also have to set {SMTP}{Username}
and {SMTP}{Password}
. If you do not want to enable mailing or want to enable it later you can uncheck {EnableEmail}
.
You now have a basic, unauthenticated installation running. At this point you can just point your Web browser at
http://yourdomain.com/twiki/bin/view
and start TWiki-ing away!
Important Server Security Settings
Before you continue any further there are some basic and very important security settings you have to make sure are set correctly.
- As already described above you should protect the configure script from general access. The configure script is designed for use by administrators only and should be restricted to invocation by them only, by using the basic Apache authentication. Because of this there has not been put much effort into hardening the script. The configure script cannot save any settings once the password has been saved the first time, but the script could still be vulnerable to specially crafted field values and the script reveals many details about the webserver that you should not display in public.
- You absolutely must turn off any kind of PHP, Perl, Python, Server Side Includes etc in the
pub
directory. TWiki has some built-in protection which renames files with dangerous filenames by appending .txt to the filename. But this is a secondary security measure. The essential action that you must take is to turn off any possible execution of any of the attached files.
Most Linux distributions have a default Apache installation which has PHP and server side include (SSI) enabled.
- Make sure that you deny access to all other twiki directories than the
bin
and pub
directories. When you have access to the Apache config files the twiki_httpd_conf.txt
file mentioned above also contains protection of these directories.
For those that do not have access to the Apache config files a sample subdir-htaccess.txt
file can be copied as .htaccess
to the data, lib, locale, templates, tools and working directories.
The
TWiki:TWiki.ApacheConfigGenerator as well as the example
twiki_httpd_conf.txt
and example
htaccess.txt
files include the needed settings that protect against all 3 security elements.
Next Steps
Once you have TWiki installed and running, you might consider the following optional steps for setting up and customizing your TWiki site. Many of the references below refer to topics within your TWiki installation. For example,
TWiki.TWikiSkins
refers to the
TWikiSkins
topic in your TWiki web. Easy way to jump directly to view the pages is to open your own TWiki in your browser and write
TWiki.TWikiSkins
in the Jump test box to the right in the top bar and hit Enter. You can find these topics in the on-line reference copy at the official TWiki website:
TWiki Release 4.2
Enable Authentication of Users
This step provides for site access control and user activity tracking on your TWiki site.
This is particularly important for sites that are publicly accessible on the web. This guide describes only the most common of several possible authentication setups for TWiki and is suitable for public web sites. For information about other setups, see
TWiki.TWikiUserAuthentication
, and
TWiki:TWiki.TWikiUserAuthenticationSupplement.
These are the steps for enabling "Template Login" which asks for a username and password in a web page, and processes them using the Apache 'htpasswd' password manager. Users can log in and log out.
- Under the
Security Settings
pane of configure
:
- Select
TWiki::Client::TemplateLogin
for {LoginManager}
.
- Select
TWiki::Users::HtPasswdUser
for {PasswordManager}
.
- Save your
configure
settings.
- Register yourself using the
TWiki.TWikiRegistration
topic.
Check that the password manager recognizes the new user. Check that a new line with the username and encrypted password is added to the data/.htpasswd
file. If not, you probably got a path wrong, or the permissions may not allow the webserver user to write to that file.
- Edit a topic (by clicking on the
Edit
link at beginning or end of topic) to check if authentication works.
You are strongly encouraged to read
TWiki.TWikiUserAuthentication
,
TWiki:TWiki.TWikiUserAuthenticationSupplement, and
TWiki:TWiki.SecuringTWikiSite for further information about managing users and security of your TWiki site.
Note! The other
LoginManager
option
TWiki::Client::ApacheLogin
uses a basic Apache type authentication where the browser itself prompts you for username and password. Most will find the TemplateLogin looking nicer. But ApacheLogin is required when you use Apache authentication methods like mod_ldap where all authentication is handled by an Apache module and not by the TWiki perl code. When you use ApacheLogin the apache configuration must be set up to require authentication of the some but not all the scripts in the bin directory. This section in the Apache config (or .htaccess) controls this
<FilesMatch "(attach|edit|manage|rename|save|upload|mail|logon|rest|.*auth).*">
require valid-user
</FilesMatch>
The
TWiki:TWiki.ApacheConfigGenerator includes this section when you choose
ApacheLogin. In the example
twiki_httpd_conf.txt
and
bin/.htaccess.txt
files this section is commented out with #. Uncomment the section when you use
ApacheLogin. It is important that this section is commented out or removed when you use
TemplateLogin.
Define the Administrator User(s)
Administrators have read and write access to any topic in TWiki, irrespectively of TWiki access controls. When you install TWiki one of the first things you will want to do is define yourself as an administrator. You become an administrator simply by adding yourself to the
TWikiAdminGroup
. It is the
WikiName and not the login name you add to the group. Editing the
Main.TWikiAdminGroup
topic requires that you are an administrator. So to add the first administrator you need to login using the internal TWiki admin user login and the password you defined in configure.
- Navigate to the
Main.TWikiAdminGroup
topic
- Follow carefully the steps
Main.TWikiAdminGroup
of how to become an admin
- Note that if you use ApacheLogin you have to be registered and logged in before you use the internal admin login
Set TWiki Preferences
Preferences for customizing many aspects of TWiki are set simply by editing a special topic with TWiki.
-
TWiki.TWikiPreferences
. Read through it and identify any additional settings or changes you think you might need. You can edit the settings in TWiki.TWikiPreferences
but these will be overwritten when you later upgrade to a newer TWiki version. Instead copy any settings or variables that you want to customize from TWiki.TWikiPreferences
and paste them into Main.TWikiPreferences
. When you later upgrade TWiki simply avoid overwriting the data/Main/TWikiPreferences.txt
file and all your settings will be kept. Settings in Main.TWikiPreferences
overrides settings in both TWiki.TWikiPreferences
and any settings defined in Plugin topics. See notes at top of TWiki.TWikiPreferences
for more information.
Enable Email Notification
Each TWiki web has an automatic email notification service that sends you an email with links to all of the topics modified since the last alert. To enable this service:
- Confirm the Mail and Proxies settings in the Configure interface.
- Setup a cron job (or equivalent) to call the
tools/mailnotify
script as described in the TWiki.MailerContrib
topic.
Enable WebStatistics
You can generate a listing manually, or on an automated schedule, of visits to individual pages, on a per web basis. For information on setting up this feature, see the
TWiki.TWikiSiteTools
topic.
Automate removal of expired sessions and lease files
Per default TWiki cleans out expired session and lease files each time any topic is viewed. This however cost performance. It is an advantage to define a negative value in
configure
for {Sessions}{ExpireAfter} and install let cron run the
tools/tick_twiki.pl
script. Read The topic
TWikiScripts#tick_twiki_pl
for details how to do this.
Enable Localisation
TWiki now supports displaying of national (non-ascii) characters and presentation of basic interface elements in different languages. To enable these features, see the
Localisation
section of
configure
. For more information about these features, see
TWiki:TWiki.InternationalizationSupplement.
Tailor New Users Home Topic
When a new users registers on your TWiki, a home topic is created for them based on the
TWiki.NewUserTemplate
topic (and its
TWiki.UserForm
). It contains additional resources you can use to:
- Localise the user topic.
- Add a default ALLOWTOPICCHANGE so only the user can edit their own home topic. We do not encourage this for Intranet sites as it sends a wrong signal to new users, but it can be necessary on a public TWiki to prevent spam.
- Add and remove fields defined in the
TWiki.UserForm
If you choose to tailor anything you are strongly adviced to copy
NewUserTemplate
and
UserForm
to the Main web and tailor the Main web copies. TWiki will look for the
NewUserTemplate
in the Main web first and if it does not exist it uses the default from the TWiki web. By creating a
Main.NewUserTemplate
and its
Main.UserForm
you will not loose your tailorings next time you upgrade TWiki.
If you added or removed fields from the user form you may also need to tailor
TWiki.TWikiRegistration
.
Install Plugins
TWiki:Plugins is an extensive library of Plugins for TWiki, that enhance functionality in a huge number of ways. A few plugins are pre-installed in the TWiki distribution. For more information on these, see
TWiki.InstalledPlugins
.
You activate installed plugin in the
Plugins section of
configure
. In this section you also find a
Find More Extensions button which opens an application which can install additional plugins from the TWiki.org website. If you are behind a firewall or your server has no access to the Internet it is also possible to install plugins manually. Manual installation instructions for the plugins can be found in the plugin topics on TWiki.org. Additional documenation on TWiki plugins can be found at
TWiki:TWiki.TWikiPluginsSupplement.
Some plugins require that you define their settings in
configure
. You fill find these under the
Extensions section of configure.
Customize Your TWiki!
The real power of TWiki lies in it's flexibility to be customized to meet your needs. You can with small means change the looks of the default skin (called PatternSkin) by reading the
TWiki.PatternSkinCustomization
At the official TWiki website you can find more resources. A good place to start for exploring what's possible is
TWiki:TWiki.TWikiAdminCookBook which offers tips and tricks for customizing your TWiki site. Many of these are appropriate to implement immediately after installing TWiki and before adding content so now's a good time to look at these.
Customization of Special Pages
Some pages are meant to be customized after choice of authentication. If you do not use the internal TWiki password manager the topics that contains the features for changing and resetting passwords and changing the email address should be changed to a note describing how to perform these tasks in your organization. The topics are:
-
TWiki.ChangePassword
-
TWiki.ResetPassword
-
TWiki.ChangeEmailAddress
WYSIWYG vs Raw Edit
From TWiki release 4.2.0 the WYSIWYG editor has been replaced by a much better and more powerful editor and it was decided that WYSIWYG would be the default edit mode. An Edit Raw link is available for those that have a need or preference for this mode.
However you may prefer to have the same user interface as in TWiki 4.1 where
Edit was the raw text editor and you had a WYSIWYG button. You can modify the templates that define the buttons by following the description on
TWiki:Codev.TWikiRawEditDefault04x02.
Copyright, License and Classification Statements
In the bottom of each topic you will find a default copyright messages saying "Copyright &© by the contributing authors. All material on this collaboration platform is the property of the contributing authors." It is a setting WEBCOPYRIGHT that defines this. This is often not adequate.
- If your TWiki is used in a commercial application without public access you should replace this by your normal copyright notice. You should also consider adding classifications (e.g. For Internal Use Only) so people do not have to add this manually to every new topic.
- If your TWiki is public with public access you need to decide which copyright and license the contributions should be covered by. For open source type applications licenses such as the GNU Free Documentation License, FreeBSD Documentation License, and Creative Commons license are possible licenses to consider. Remember that once people have started contributing it is difficult and not correct to change or impose licenses on existing contributions.
You change the copy right statement globally by taking these steps.
- Copy the setting WEBCOPYRIGHT from
TWiki.TWikiPreferences
to Main.TWikiPreferences
and alter the copied text to your need.
- You can create a unique message for each web by adding the WEBCOPYRIGHT setting to
WebPreferences
in each web. E.g. adding a confidencial classification to a very restricted web.
- The WEBCOPYRIGHT in
TWiki.WebPreferences
covers the documentation that comes with TWiki and is covered by the original TWiki Copyright and GPL License. You will normally leave this unchanged.
Troubleshooting
The first step is to re-run the
configure
script and make sure you have resolved all errors, and are satisfied that you understand any warnings.
Failing that, please check
TWiki:TWiki.InstallingTWiki on TWiki.org, the supplemental documentation that help you
install TWiki on different platforms, environments and web hosting sites. For example:
It is also advisable to review
TWiki:Codev.KnownIssuesOfTWiki04x02.
If you need help, ask a question in the
TWiki:Support web or on
TWiki:Codev/TWikiIRC (irc.freenode.net, channel #twiki)
Appendices
TWiki System Requirements
Low client and server base requirements are core features that keep TWiki widely deployable, particularly across a range of browser platforms and versions.
Server Requirements
TWiki is written in Perl 5, uses a number of shell commands, and requires
RCS (Revision Control System), a GNU Free Software package. TWiki is developed in a basic Linux/Apache environment. It also works with Microsoft Windows, and should have no problem on any other platform that meets the requirements.
Resource |
Required Server Environment |
Perl |
5.8.4 or higher is recommended. TWiki will run in perl 5.6.1 but only with Wysiwyg editor disabled. Wysiwyg requires unicode support which is provided by perl 5.8.1 and forward. |
RCS |
5.7 or higher (including GNU diff ) Optional, TWiki includes a pure perl implementation of RCS that can be used instead (although it's slower) |
GNU diff |
GNU diff 2.7 or higher is required when not using the all-Perl RcsLite?. Install on PATH if not included with RCS (check version with diff -v ) Must be the version used by RCS, to avoid problems with binary attachments - RCS may have hard-coded path to diff |
Other external programs |
fgrep, egrep |
Cron/scheduler |
• Unix: cron • Windows: cron equivalents |
Web server |
Apache is well supported; for information on other servers, see TWiki:TWiki.InstallingTWiki#OtherWebServers. |
Required CPAN Modules
Most of the CPAN libraries listesd below are part of a standard Perl installation so you most likely have them all!
See
TWiki:TWiki.HowToInstallCpanModules for detailed information on how to install CPAN libraries
The following Perl
CPAN modules are used by TWiki:
Module |
Preferred version |
Algorithm::Diff (included) |
|
CGI |
Versions 2.89 and 3.37 must be avoided. Most version from 3.15 and onwards should work. |
CGI::Carp |
>=1.26 |
Config |
>=0 |
Cwd |
>=3.05 |
Data::Dumper |
>=2.121 |
Error (included) |
|
File::Copy |
>=2.06 |
File::Find |
>=1.05 |
File::Spec |
>=3.05 |
FileHandle |
>=2.01 |
IO::File |
>=1.10 |
Text::Diff (included) |
|
Time::Local |
>=1.11 |
Optional CPAN Modules
The following Perl modules may be used by TWiki:
See
TWiki:TWiki.HowToInstallCpanModules for detailed information on how to install CPAN libraries
Module |
Preferred version |
Description |
Archive::Tar |
|
May be required by the Extensions Installer in configure if command line tar or unzip is not available |
CGI::Cookie |
>=1.24 |
Used for session support |
CGI::Session |
>=3.95 |
Highly recommended! Used for session support |
Digest::base |
|
|
Digest::SHA1 |
|
|
Jcode |
|
Used for I18N support with perl 5.6 |
Locale::Maketext::Lexicon |
>=0 |
Used for I18N support |
Net::SMTP |
>=2.29 |
Used for sending mail |
Unicode::Map |
|
Used for I18N support with perl 5.6 |
Unicode::Map8 |
|
Used for I18N support with perl 5.6 |
Unicode::MapUTF8 |
|
Used for I18N support with perl 5.6 |
Unicode::String |
|
Used for I18N support with perl 5.6 |
URI |
|
Used for configure |
Most of them will probably already be available in your installation. You can check version numbers with the
configure
script, or if you're still trying to get to that point, check from the command line like this:
perl -e 'use FileHandle; print $FileHandle::VERSION."\n"'
Client Requirements
The TWiki standard installation has relatively low browser requirements:
- HTML 3.2 compliant
- Cookies, if persistent sessions are required
CSS and Javascript are used in most skins, although there is a low-fat skin (Classic skin) available that minimises these requirements. Some skins will require more recent releases of browsers. The default skin (Pattern) is tested on IE 6, Safari, and Mozilla 5.0 based browsers (such as Firefox).
You can easily select a balance of browser capability versus look and feel. Try the installed skins at
TWiki/TWikiSkinBrowser
and more at
TWiki:Plugins.SkinPackage.
Important note about TWiki Plugins
- Plugins can require just about anything - browser-specific functions, stylesheets (CSS), Java applets, cookies, specific Perl modules,... - check the individual Plugin specs.
-
Note: Plugins included in the TWiki distribution do not add requirements, except for the CommentPlugin which requires Perl 5.6.1.
Notes on Installing TWiki on Non-Root Account
The following supplemental notes to the
Basic Installation instructions apply to installing TWiki on a system where you don't have Unix/Linux root (administrator) privileges, for example, on a hosted Web account or an intranet server administered by someone else.
Referring to the
Basic Installation steps presented above:
- Step 2: If you cannot unpack the TWiki distribution directly in your installation directory, you can unpack the distribution on your local PC and then manually create the directory structure on your host server and upload the files as follows:
- Using the table below, create a directory structure on your host server
- Upload the TWiki files by FTP (transfer as text except for the image files in
pub
directory.)
- Note: Don't worry if you are not able to put the twiki/lib directory at the same level as the
twiki/bin
directory (e.g. because CGI bin directories can't be under your home directory and you don't have root access). You can create this directory elsewhere and configure the twiki/bin/setlib.cfg
file (done in Step 2).
TWiki dir: |
What it is: |
Where to copy: |
Example: |
twiki |
start-up pages |
root TWiki dir |
/home/smith/twiki/ |
twiki/bin |
CGI bin |
CGI-enabled dir |
/home/smith/twiki/bin |
twiki/lib |
library files |
same level as twiki/bin |
/home/smith/twiki/lib |
twiki/locale |
language files |
dir secure from public access |
/home/smith/twiki/locale |
twiki/pub |
public files |
htdoc enabled dir |
/home/smith/twiki/pub |
twiki/data |
topic data |
dir secure from public access |
/home/smith/twiki/data |
twiki/templates |
web templates |
dir secure from public access |
/home/smith/twiki/templates |
twiki/tools |
TWiki utlilities |
dir secure from public access |
/home/smith/twiki/tools |
twiki/working |
Temporary and internal files |
dir secure from public access |
/home/smith/twiki/working |
- Step 3: Files in the pub directory must be readable as a url. This means that directory permissions should be set to
755
(or 775
) and file permissions should be set to 644
(or 664
). If you can run a chmod
command, you can accomplish this in two quick steps by running these commands from the root direct:
-
chmod -R 755 pub
-
chmod 644 `find pub -type f -print`
- In addition, you should create a
.htaccess
file in the pub directory, using the template included in the root level of the distribution entitled pub-htaccess.txt
.
- Note: This setup does not provide for absolute security for TWiki attachments. For more information, see TWiki:Codev.SecuringYourTWiki.
- Step 6: In order to run the configure script, create a file called
.htaccess
in the bin directory that includes the following single line: SetHandler cgi-script
. This informs the server to treat all the perl scripts in the bin directory as scripts.
For additional information about installing TWiki on a hosted accounts, see
TWiki:TWiki.InstallingTWiki#WebHostingSites
Installing Manually Without Configure
It is highly recommended to use run configure from the browser when setting up TWiki. Configure does a lot of the hard work for you.
But there may be instances where you do not want to use configure or where configure simply won't run because of a missing dependency.
The manual steps you have to take are:
- Copy the file
lib/TWiki.spec
to lib/LocalSite.cfg
- Remove the comment # in front of
$TWiki::cfg{DefaultUrlHost}
, $TWiki::cfg{ScriptUrlPath}
, $TWiki::cfg{PubUrlPath}
, $TWiki::cfg{PubDir}
, $TWiki::cfg{TemplateDir}
, $TWiki::cfg{DataDir}
, $TWiki::cfg{LocalesDir}
, and $TWiki::cfg{OS}
and make sure these settings have the correct values.
- Make sure to define at least these settings:
$TWiki::cfg{LoginManager}
, $TWiki::cfg{WebMasterEmail}
, $TWiki::cfg{SMTP}{MAILHOST}
, $TWiki::cfg{SMTP}{SENDERHOST}
.
Back to top
TWiki Upgrade Guide
This guide covers upgrading from a previous version of TWiki (such as Cairo or TWiki4.0) to TWiki 4.2
- TWiki System Requirements
- TWiki Installation Guide
- TWiki Upgrade Guide
- Wiki User Authentication
- Wiki Access Control
- Raw Edit Formatting or Wiki Text Formatting
- Wiki Variables
- TWiki Formatted Search
- File Attachments
- TWiki Forms
- TWiki Templates
- TWiki Skins
- TWiki Meta Data
- TWiki Add-Ons
- TWiki Contribs
- TWiki Plugins
- Overview
- Installing Plugins
- Managing Installed Plugins
- The TWiki Plugin API
- Creating Plugins
- Recommended Storage of Plugin Specific Data
- Integrating with
configure
- Maintaining Plugins
- Environment
- Preferences
- User Handling and Access Control
- Webs, Topics and Attachments
- getListOfWebs( $filter ) -> @webs
- webExists( $web ) -> $boolean
- createWeb( $newWeb, $baseWeb, $opts )
- moveWeb( $oldName, $newName )
- eachChangeSince($web, $time) -> $iterator
- getTopicList( $web ) -> @topics
- topicExists( $web, $topic ) -> $boolean
- checkTopicEditLock( $web, $topic, $script ) -> ( $oopsUrl, $loginName, $unlockTime )
- setTopicEditLock( $web, $topic, $lock )
- saveTopic( $web, $topic, $meta, $text, $options ) -> $error
- saveTopicText( $web, $topic, $text, $ignorePermissions, $dontNotify ) -> $oopsUrl
- moveTopic( $web, $topic, $newWeb, $newTopic )
- getRevisionInfo($web, $topic, $rev, $attachment ) -> ( $date, $user, $rev, $comment )
- getRevisionAtTime( $web, $topic, $time ) -> $rev
- readTopic( $web, $topic, $rev ) -> ( $meta, $text )
- readTopicText( $web, $topic, $rev, $ignorePermissions ) -> $text
- attachmentExists( $web, $topic, $attachment ) -> $boolean
- readAttachment( $web, $topic, $name, $rev ) -> $data
- saveAttachment( $web, $topic, $attachment, $opts )
- moveAttachment( $web, $topic, $attachment, $newWeb, $newTopic, $newAttachment )
- Assembling Pages
- readTemplate( $name, $skin ) -> $text
- loadTemplate ( $name, $skin, $web ) -> $text
- expandTemplate( $def ) -> $string
- writeHeader( $query, $contentLength )
- redirectCgiQuery( $query, $url, $passthru )
- addToHEAD( $id, $header )
- expandCommonVariables( $text, $topic, $web, $meta ) -> $text
- renderText( $text, $web ) -> $text
- internalLink( $pre, $web, $topic, $label, $anchor, $createLink ) -> $text
- E-mail
- Creating New Topics
- Special handlers
- Searching
- Plugin-specific file handling
- General Utilities
- StaticMethod sanitizeAttachmentName ($fname) -> ($fileName,$origName)
- Deprecated functions
- TWiki CGI and Command Line Scripts
- TWiki Site Tools
- Managing Topics
- Managing Webs
- Manage Users
- Appendix A: TWiki Development Time-line
- Appendix B: Encode URLs With UTF8
- Appendix C: TWiki CSS
Overview
TWiki-4.0.0 was a major new release. TWiki-4.1.0 was a minor release without dramatic changes since 4.0.0. TWiki-4.2.0 is also a minor release containing a few new features that can be seen by the end user, a large number of bug fixes, and a face lift for the skin. It also contains some important updates under the hood to the way users are handled which enables new types of authentication and integration with other systems. The most important new feature is the
QuerySearch feature.
Upgrade Requirements
- Please review the AdminSkillsAssumptions before you upgrade TWiki
- Review TWiki:TWiki.TWikiUpgradeTo04x02 for latest information and experience notes.
- To upgrade from a release prior to TWiki Release 01-Sep-2004, start with TWiki:TWiki.UpgradingTWiki on TWiki.org
- To upgrade from a standard TWiki Release 01-Sep-2004 to the latest TWiki-4.X Production Release, follow the instructions below
- Once the upgrade has been applied, an existing earlier installation will still be able to read all the topics, but should not be used to write. Make sure you take a backup!
- Not all Plugins written for TWiki Release 01-Sep-2004 are fully supported with 4.X. Make sure the Plugins you use can be upgraded as well!
Major Changes Compared to TWiki Release 01-Sep-2004 and TWiki Release 4.0.0
See
TWikiReleaseNotes04x00,
TWikiReleaseNotes04x01 and
TWikiReleaseNotes04x02
Upgrade Procedure
The following steps are a rough guide to upgrading only. It is impossible to give detailed instructions, as what you have to do may depend on whether you can configure the webserver or not, and how much you have changed distributed files in your current TWiki release.
The main steps are:
- Install the new TWiki version, configure it, and get it to work similar to the old version
- Install additional extensions (Plugins). Make sure to use the latest versions
- Copy all the non-default webs from the old installation to the new
- Copy the users from old installation to the new incl all their topics from Main
- Apply tailorings to your Skin (logos, menu bars etc)
- Apply preferences from old installation
Installation
- Follow the installation instructions in INSTALL.html which you find in the root of the new installation. Install the new release in a new directory. Do not install on top of the old release.
- Use the configure script to configure TWiki.
- If you are upgrading from a 4.x.x release, you can carry over the configure settings from the old release.
- You need to run configure and save the configuration once when you upgrade as this will update the altered and added settings.
- You can also choose to start with a fresh configuration and walk through all the settings using your old LocalSite.cfg as a reference. This way you will not have old obsolete settings in the new LocalSite.cfg.
- If at any time during the installation you want to start over from fresh all you need to do is delete the
lib/LocalSite.cfg
file and re-run configure.
- Additional resources
- Make sure you have a working basic TWiki before you continue
Install Extensions
- Note that not all extensions that worked in Cairo have been updated to work with TWiki4.X. Many Cairo plugins work fine. Some do not. Many plugins have been upgraded to work with TWiki4.0 and later.
- From TWiki-4.1.0 the configure script which you ran during installation supports installation of additional plugins.
- Manual installation is possible. Follow the instruction on the Plugin page at twiki.org.
- Check the plugin topics from your old TWiki installation. There may be plugin settings that you want to transfer to the new TWiki installation.
Hint: For an easier upgrade later on, set the plugin preferences settings in the Main.SitePreferences topic, not in the plugin topic. To identify the plugin, prefix the name of the setting with the capitalized name of the plugin. For example, to change the DEFAULT_TYPE
setting of the CommentPlugin, create a COMMENTPLUGIN_DEFAULT_TYPE
setting in Main.SitePreferences.
- Typical plugin settings you may have altered.
- CommentPlugin - Set DEFAULT_TYPE
- EditTablePlugin - Set CHANGEROWS, Set QUIETSAVE, and Set EDITBUTTON
- InterwikiPlugin - Set RULESTOPIC
- InterWikis - If you added your own rules you should save this topic and not overwrite it.
- SlideShowPlugin - Make sure you did not change the embedded 'Default Slide Template' If you did you should save it. It is a bad idea to do. It is better to define your own slide show templates as separate topics that do not get overwritten when you upgrade.
- SmiliesPlugin - Did you add your own smileys? No real changes were made to the smilies topic October 2005 so you can just leave this topic as it is.
- TablePlugin - Set TABLEATTRIBUTES
- Remember that a plugin must be activated in configure.
- To avoid having to re-apply plugin settings each time you upgrade a plugin or TWiki itself, define the altered plugin settings in
Main.TWikiPreferences
instead
Copy your old webs to new TWiki
- When upgrading from Cairo or earlier it may be necessary to unlock the rcs files in data and pub directories from the old installation using the following shell commands:
-
find data -name '*,v' -exec rcs -u -M '{}' \;
-
find pub -name '*,v' -exec rcs -u -M '{}' \;
- Copy your local webs over to the data and pub directories of the new install. Do not copy the default webs: TWiki, Main, Trash, Sandbox, _default, and _empty.
- Make sure all data and pub files and directories are owned by the webserver user.
- Note: TWiki's WebChanges topics depend on the file timestamp. If you touch the .txt files make sure to preserve the timestamp, or to change them in the sequence of old file timestamps.
Copy Users And Their Topics From Main Web
- Copy all the topics from the Main web and corresponding pub/Main directories from the old TWiki to the new TWiki but do not overwrite any of the new topics already inside the new Main directory!
- Manually merge all the users from the old
Main.TWikiUsers
topic to the new TWiki. If you upgrade from Cairo you can simply use the old file and add the missing new system users to the list of users. If you upgrade from TWiki-4.0.X simply use the old topic. Starting from 4.2.0 TWiki no longer ships with a Main.TWikiUsers
topic. When you register the first user TWiki now checks for an existing Main.TWikiUsers
and if it does not exist it gets created.
- If you use
data/.htpasswd
for authentication copy this file from the old TWiki to the new.
- If you upgrade from Cairo and you are using the Htpasswd login manager, then note that email addresses for users have moved out of user topics and into the password file. There is a script that performs this extra upgrade step for you - see
tools/upgrade_emails.pl
.
- The old sandbox web may have a lot of useful topic and users may use it actively for drafts. Manually select the topics (remember the corresponding pub directories) from the old Sandbox web and copy them to the new TWiki. Decide if you want to overwrite the sandbox homepage and left menu bar or keep the new.
- If you added or removed fields from the user topic form you may also have tailored
TWiki.TWikiRegistration
. Make sure you either reuse the registration topic from the old installation or apply the same field changes to the new TWiki.TWikiRegistration
topic.
- Starting from 4.2.0 TWiki ships with
NewUserTemplate
and UserForm
in the TWiki web. If you choose to tailor anything you are strongly adviced to copy NewUserTemplate
and UserForm
to the Main web and tailor the Main web copies. TWiki will look for the NewUserTemplate
in the Main web first and if it does not exist it uses the default from the TWiki web. By creating a Main.NewUserTemplate
and its Main.UserForm
you will not loose your tailorings next time you upgrade TWiki.
- Make sure all data and pub files and directories are owned by the webserver user.
Apply Customizations To The Skin
- Not many of the old Cairo skins work well with TWiki4.X.
- Add Logos, update top bar and left bar as required.
- Apply any desired changes to style sheets and templates. The default PatternSkin has been totally rewritten since Cairo and once more in 4.0.2. Since then changes to PatternSkin have been minor and you may be able to carry over most simpler tailorings directly from 4.0.2-4.0.5.
- Additional resources:
Apply Preferences From Old Installation
- Transfer any customized and local settings from System.TWikiPreferences to the topic pointed at by {LocalSitePreferences} (Main.SitePreferences). Per default this is
Main.TWikiPreferences
. This avoids having to write over files in the distribution on a later upgrade.
- If you changed any of the topics in the original TWiki distribution, you will have to transfer your changes to the new install manually. There is no simple way to do this, though a suggestion is to use 'diff' to find changed files in the
data/TWiki
of the old and new TWiki installation, and transfer the changes into the new TWiki install. If you can run a GUI on your server, you may find that using a visual diff tool like WinMerge, meld, kdiff3, xxdiff, etc. is helpful.
- Compare the
WebPreferences
topics in the old TWiki Installation with the default from the new TWiki installation and add any new Preferences that may be relevant.
- Compare the
Trash.TWikiWebLeftBar
topics in the old TWiki Installation with the default from the new TWiki installation and add any new feature that you desire.
Customization of Special Pages
Some pages in the TWiki web are meant to be customized after choice of authentication. If you do not use the internal TWiki password manager the topics that contains the features for changing and resetting passwords and changing the email address should be changed to a note describing how to perform these tasks in your organization. If you have made such customizations remember to replace these topics in the TWiki web with the tailored versions from your old installation. The topics are:
-
TWiki.ChangePassword
-
TWiki.ResetPassword
-
TWiki.ChangeEmailAddress
Upgrading from Cairo to TWiki4 (additional advice)
Favicon
TWiki4's
PatternSkin introduces the use of the favicon feature which most browsers use to show a small icon in front of the URL and for bookmarks.
In TWiki4 it is assumed that each web has a favicon.ico file attached to the WebPreferences topic. When you upgrade from Cairo to TWiki4 you do not have this file and you will get flooded with errors the error log of your web server. There are two solutions to this.
- Attach a favicon.ico file to WebPreferences in each web.
- Preferred: Change the setting of the location of favicon.ico in TWikiPreferences so all webs use the favicon.ico from the TWiki web. This is the fastest and easiest solution.
To change the location of favicon.ico in TWikiPreferences to the TWiki web add this line to
TWikiPreferences
* Set FAVICON = %PUBURLPATH%/%SYSTEMWEB%/%WEBPREFSTOPIC%/favicon.ico
TWikiUsers topic in Main web
Your Cairo
Main.TWikiUsers topic will work in TWiki4 but you will need to ensure that these 4 users from the default TWiki4 version of TWikiUsers are copied to the existing TWikiUsers topic. TWikiGuest is probably already there but the others are new
- TWikiContributor - placeholder for a TWiki developer, and is used in TWiki documentation
- TWikiGuest - guest user, used as a fallback if the user can't be identified
- TWikiRegistrationAgent - special user used during the new user registration process
- UnknownUser - used where the author of a previously stored piece of data can't be determined
You additionally need to ensure that TWikiUsers has the
Set ALLOWTOPICCHANGE = TWikiAdminGroup, TWikiRegistrationAgent
. Otherwise people will not be able to register.
Important Changes since 4.0.5
Supported Perl version
TWiki 4.0.5 worked on Perl version 5.6.X. Reports from users has shown that unfortunately TWiki 4.1.0 does not support Perl versions older then 5.8.0. It is the goal that TWiki should work on at least Perl version 5.6.X but none of the developers have had access to Perl installations older than 5.8.0.
Since TWiki 4.1.0 has some urgent bugs the development team decided to release TWiki 4.1.1 without resolving the issue with Perl 5.6.X. We will however address this and try and resolve it for a planned 4.1.2 release. The TWiki community is very interested in contributions from users that have fixes for the code which will enable TWiki to run on older versions of Perl.
See the
WhatVersionsOfPerlAreSupported topic to keep up to date with the discussion how to get back support for earlier Perl versions.
Template spec changed
Until TWiki 4.0.5
TWikiTemplates the text inside template definition blocks (anything between %TMPL:DEF{"block"}% and %TMPL:END% was stripped of leading and trailing white space incl new lines.
This caused a lot of problems for skin developers when you wanted a newline before or after the block text.
From TWiki 4.1.0 this has changed so that white space is no longer stripped. Skins like PatternSkin and NatSkin have been updated so that they work with the new behavior. But if you use an older skin or have written your own you will most likely need to make some adjustments.
It is not difficult. The general rule is - if you get mysterious blank lines in your skin, the newline after the %TMPL:DEF{"block"}% needs to be removed. Ie. the content of the block must follow on the same line as the TMPL:DEF.
The spec change have the same impact on
CommentPlugin templates where you may have to remove the first line break after the TMPL:DEF. See the
CommentPluginTemplate for examples of how comment template definitions should look like in TWiki-4.1.X
An example: A CommentPlugin template that adds a comment as appending a row to a table. Before the spec change this would work.
<verbatim>
%TMPL:DEF{OUTPUT:tabletest}%%POS:BEFORE%
|%URLPARAM{"comment"}%| -- %WIKIUSERNAME% - %DATE% |
%TMPL:END%
</verbatim>
From Twiki 4.1.0 the old template definition will add an empty line before the new table row. To fix it simply remove the new line before the table.
<verbatim>
%TMPL:DEF{OUTPUT:tabletest}%%POS:BEFORE%|%URLPARAM{"comment"}%| -- %WIKIUSERNAME% - %DATE% |
%TMPL:END%
</verbatim>
The advantage of the spec change is that now you can add leading and trailing white space including new lines. This was not possible before.
Important Changes since 4.1.0
New location for session and other temporary files
An upgrader upgrading to 4.1.1 should note the following important change
The directory for passthrough files and session files have been replaced by a common directory for temporary files used by TWiki. Previously the two configure settings
{PassthroughDir}
and
{Sessions}{Dir}
were by default set to
/tmp
. These config settings have been replaced by
{TempfileDir}
with the default setting value
/tmp/twiki
. If the
twiki
directory does not exist twiki will create it first time it needs it.
It is highly recommended no longer to use the tmp directory common to other web applications and the new default will work fine for most. You may want to delete all the old session files in /tmp after the upgrade to 4.1.1. They all start with cgisess_. It is additionally highly recommended to limit write access to the
{TempfileDir}
for security reasons if you have non-admin users with login access to the webserver just like you would do with the other webserver directories.
Important Changes since 4.1.2
New WYSIWYG Editor
TWiki now ships with a new WYSIWYG editor based on TinyMCE replaces the Kupu based editor.
TinyMCE is not a perfect Wysiwyg editor but it is magnitudes better than the Kupu editor
The WysiwygPlugin that drives the engine behind both TinyMCE has additionally been heavily improved so that less TWiki Applications are negatively affected by editing WYSIWYG
When TinyMCEPlugin is enabled the Edit button per default becomes WYSIWYG editing mode. A new Raw Edit link has been added to enable application developers to edit the good old way
The WYSIWYG button has been removed.
NEWTOPICLINKSYMBOL removed
The NEWTOPICLINKSYMBOL preference which was deprecated in 4.1 has now been removed from the code. If you want to control the appearance of new links, you can use NEWLINKFORMAT.
UserForm and NewUserTemplate Customization
When a new user registers on TWiki his user topic is created based on the
NewUserTemplate
and
UserForm
.
The
NewUserTemplate
was located in the TWiki web and the
UserForm
in the Main web. When upgrading TWiki these were some of the topics you had to take care not to overwrite.
From 4.2.0 the
UserForm
and
NewUserTemplate
are distributed in the TWiki web. If you create the two in the Main web the Main web version will be used instead. So if you tailor the user topic format or the form then you should always copy the two files to the Main web and modify the ones in the Main web. When you later upgrade TWiki your tailored template and form will not be overwritten.
TWikiUsers no longer distributed
The
Main.TWikiUsers
topic contains all the registered users. It is a topic you do not want to overwrite when you upgrade TWiki.
From 4.2.0 this file is no longer included in the TWiki distribution. When you register the first time TWiki creates the
Main.TWikiUsers
topic in the Main web if it does not exist already. This means that you can now upgrade TWiki without risk of overwriting the important
TWikiUsers
topic.
- For new installers this makes no difference at all
- For upgraders this is one less problem to worry about as your important Main.TWikiUsers topic now no longer gets overwritten when upgrading.
New working
directory
A new directory
working
which per default is located in the twiki root, has been introduced which contains:
- registration_approvals - with 4.2.0 it is moved to here from the data directory)
- tmp - so we now avoid having to fight with special access rights and /tmp directory that gets cleaned out when booting.
- work_areas - with 4.2.0 it is moved to here from the pub directory. Configure automatically moved the directory when you upgrade.
Note: Remember to restrict access to this new directory when you upgrade.
The configuration setting
{WorkingDir}
defines the container directory for temporary files, extensions' work areas, and intermediate registration data. The default is
working
under your installation root.
Take care for that change if you run your own routine to delete obsolete session files, which will now be found under
working/tmp/cgisess*
.
New Internal Admin Login
TWiki 4.2 introduces a new
Internal Admin Login feature which uses "admin" (configurable) as username and the password used for configure to become temporary administrator. When you do a new installation you need to use this feature as Main.TWikiAdminGroup is now access restricted by default to avoid security attacks during the hours an installation may take. From configure there is a link to the TWikiAdminGroup topic and on TWikiAdminGroup the step by step instructions are written in a yellow box. Our advice is not to remove this help text in case you need it later.
Back to top
Wiki User Authentication
TWiki site access control and user activity tracking options
- TWiki System Requirements
- TWiki Installation Guide
- TWiki Upgrade Guide
- Wiki User Authentication
- Wiki Access Control
- Raw Edit Formatting or Wiki Text Formatting
- Wiki Variables
- TWiki Formatted Search
- File Attachments
- TWiki Forms
- TWiki Templates
- TWiki Skins
- TWiki Meta Data
- TWiki Add-Ons
- TWiki Contribs
- TWiki Plugins
- Overview
- Installing Plugins
- Managing Installed Plugins
- The TWiki Plugin API
- Creating Plugins
- Recommended Storage of Plugin Specific Data
- Integrating with
configure
- Maintaining Plugins
- Environment
- Preferences
- User Handling and Access Control
- Webs, Topics and Attachments
- getListOfWebs( $filter ) -> @webs
- webExists( $web ) -> $boolean
- createWeb( $newWeb, $baseWeb, $opts )
- moveWeb( $oldName, $newName )
- eachChangeSince($web, $time) -> $iterator
- getTopicList( $web ) -> @topics
- topicExists( $web, $topic ) -> $boolean
- checkTopicEditLock( $web, $topic, $script ) -> ( $oopsUrl, $loginName, $unlockTime )
- setTopicEditLock( $web, $topic, $lock )
- saveTopic( $web, $topic, $meta, $text, $options ) -> $error
- saveTopicText( $web, $topic, $text, $ignorePermissions, $dontNotify ) -> $oopsUrl
- moveTopic( $web, $topic, $newWeb, $newTopic )
- getRevisionInfo($web, $topic, $rev, $attachment ) -> ( $date, $user, $rev, $comment )
- getRevisionAtTime( $web, $topic, $time ) -> $rev
- readTopic( $web, $topic, $rev ) -> ( $meta, $text )
- readTopicText( $web, $topic, $rev, $ignorePermissions ) -> $text
- attachmentExists( $web, $topic, $attachment ) -> $boolean
- readAttachment( $web, $topic, $name, $rev ) -> $data
- saveAttachment( $web, $topic, $attachment, $opts )
- moveAttachment( $web, $topic, $attachment, $newWeb, $newTopic, $newAttachment )
- Assembling Pages
- readTemplate( $name, $skin ) -> $text
- loadTemplate ( $name, $skin, $web ) -> $text
- expandTemplate( $def ) -> $string
- writeHeader( $query, $contentLength )
- redirectCgiQuery( $query, $url, $passthru )
- addToHEAD( $id, $header )
- expandCommonVariables( $text, $topic, $web, $meta ) -> $text
- renderText( $text, $web ) -> $text
- internalLink( $pre, $web, $topic, $label, $anchor, $createLink ) -> $text
- E-mail
- Creating New Topics
- Special handlers
- Searching
- Plugin-specific file handling
- General Utilities
- StaticMethod sanitizeAttachmentName ($fname) -> ($fileName,$origName)
- Deprecated functions
- TWiki CGI and Command Line Scripts
- TWiki Site Tools
- Managing Topics
- Managing Webs
- Manage Users
- Appendix A: TWiki Development Time-line
- Appendix B: Encode URLs With UTF8
- Appendix C: TWiki CSS
Overview
Authentication, or "login", is the process by which a user lets TWiki know who they are.
Authentication isn't just to do with access control. TWiki uses authentication to identify users, so it can keep track of who made changes, and manage a wide range of personal settings. With authentication enabled, users can personalise TWiki and contribute as recognised individuals, instead of shadows.
TWiki authentication is very flexible, and can either stand alone or integrate with existing authentication schemes. You can set up TWiki to require authentication for every access, or only for changes. Authentication is also essential for access control.
Quick Authentication Test - Use the %USERINFO% variable to return your current identity:
- You are guest, WikiGuest?,
TWiki user authentication is split into four sections; password management, user mapping, user registration, and login management. Password management deals with how users personal data is stored. Registration deals with how new users are added to the wiki. Login management deals with how users log in.
Once a user is logged on, they can be remembered using a
Client Session stored in a cookie in the browser (or by other less elegant means if the user has disabled cookies). This avoids them having to log on again and again.
TWiki user authentication is configured through the Security Settings pane in the
configure interface.
Please note
FileAttachments are not protected by TWiki User Authentication.
Tip: TWiki:TWiki.TWikiUserAuthenticationSupplement on TWiki.org has supplemental documentation on user authentication.
Password Management
As shipped, TWiki supports the Apache 'htpasswd' password manager. This manager supports the use of
.htpasswd
files on the server. These files can be unique to TWiki, or can be shared with other applications (such as an Apache webserver). A variety of password encodings are supported for flexibility when re-using existing files. See the descriptive comments in the Security Settings section of the [[/do/configure][configure] interface for more details.
You can easily plug in alternate password management modules to support interfaces to other third-party authentication databases.
User Mapping
Often when you are using an external authentication method, you want to map from an unfriendly "login name" to a more friendly
WikiName. Also, an external authentication database may well have user information you want to import to TWiki, such as user groups.
By default, TWiki supports mapping of usernames to wikinames, and supports TWiki groups internal to TWiki. If you want, you can plug in an alternate user mapping module to support import of groups etc.
User Registration
New user registration uses the password manager to set and change passwords and store email addresses. It is also responsible for the new user verification process. the registration process supports
single user registration via the
TWikiRegistration page, and
bulk user registration via the
BulkRegistration page (for admins only).
The registration process is also responsible for creating user topics, and setting up the mapping information used by the User Mapping support.
Login Management
Login management controls the way users have to log in. There are three basic options; no login, login via a TWiki login page, and login using the webserver authentication support.
No Login (select none
in configure)
Does exactly what it says on the tin. Forget about authentication to make your site completely public - anyone can browse and edit freely, in classic Wiki style. All visitors are given the
TWikiGuest default identity, so you can't track individual user activity.
Note: This setup is
not recommended on public websites for security reasons; anyone would be able to change system settings and perform tasks usually restricted to administrators.
Template Login (select TWiki::Client::TemplateLogin
in configure)
Template Login asks for a username and password in a web page, and processes them using whatever Password Manager you choose. Users can log in and log out. Client Sessions are used to remember users. Users can choose to have their session remembered so they will automatically be logged in the next time they start their browser.
Enabling Template Login
- Use the configure interface to
- select the
TWiki::Client::TemplateLogin
login manager (on the Security Settings pane).
- select the appropriate password manager for your system, or provide your own.
-
there is also an EXPERT configure setting {TemplateLogin}{PreventBrowserRememberingPassword}
that you can set to prevent Browsers from remembering username and passwords if you are concerned about public terminal usage.
- Register yourself in the TWikiRegistration topic.
Check that the password manager recognises the new user. If you are using .htpasswd
files, check that a new line with the username and encrypted password is added to the .htpasswd
file. If not, you probably got a path wrong, or the permissions may not allow the webserver user to write to that file.
- Create a new topic to check if authentication works.
- Edit the TWikiAdminGroup topic in the Main web to include users with system administrator status.
This is a very important step, as users in this group can access all topics, independent of TWiki access controls.
TWikiAccessControl has more information on setting up access controls.

At this time
TWikiAccessControls cannot control access to files in the
pub
area, unless they are only accessed through the
viewfile
script. If your
pub
directory is set up in the webserver to allow open access you may want to add
.htaccess
files in there to restrict access.

You can create a custom version of the
TWikiRegistration form by copying the topic, and then deleting or adding input tags in your copy. The
name=""
parameter of the input tags must start with:
"Twk0..."
(if this is an optional entry), or
"Twk1..."
(if this is a required entry). This ensures that the fields are carried over into the user home page correctly. Do
not modify the version of
TWikiRegistration shipped with TWiki, as your changes will be overwritten next time you upgrade.

The default new user template page is in
System.NewUserTemplate. The same variables get expanded as in the
template topics. You can create a custom new user home page by creating the
Main.NewUserTemplate topic, which will then override the default.
Apache Login (select TWiki::Client::ApacheLogin
in configure)
Using this method TWiki does not authenticate users internally. Instead it depends on the
REMOTE_USER
environment variable, which is set when you enable authentication in the webserver.
The advantage of this scheme is that if you have an existing website authentication scheme using Apache modules such as
mod_auth_ldap
or
mod_auth_mysql
you can just plug in directly to them.
The disadvantage is that because the user identity is cached in the browser, you can log in, but you can't log out again unless you restart the browser.
TWiki maps the
REMOTE_USER
that was used to log in to the webserver to a
WikiName using the table in
TWikiUsers. This table is updated whenever a user registers, so users can choose not to register (in which case their webserver login name is used for their signature) or register (in which case that login name is mapped to their
WikiName).
The same private
.htpasswd
file used in TWiki Template Login can be used to authenticate Apache users, using the Apache Basic Authentication support.
Warning: Do
not use the Apache
htpasswd
program with
.htpasswd
files generated by TWiki!
htpasswd
wipes out email addresses that TWiki plants in the info fields of this file.
Enabling Apache Login using mod_auth
You can use any other Apache authentication module that sets REMOTE_USER.
- Use configure to select the
TWiki::Client::ApacheLogin
login manager.
- Use configure to set up TWiki to create the right kind of
.htpasswd
entries.
- Create a
.htaccess
file in the twiki/bin
directory.
There is an template for this file in twiki/bin/.htaccess.txt
that you can copy and change. The comments in the file explain what need to be done.
If you got it right, the browser should now ask for login name and password when you click on the Edit. If .htaccess
does not have the desired effect, you may need to "AllowOverride All" for the directory in httpd.conf
(if you have root access; otherwise, e-mail web server support)
At this time TWikiAccessControls do not control access to files in the pub
area, unless they are only accessed through the viewfile
script. If your pub
directory is set up to allow open access you may want to add .htaccess
files in there as well to restrict access
- You can create a custom version of the TWikiRegistration form by copying the default topic, and then deleting or adding input tags in your copy. The
name=""
parameter of the input tags must start with: "Twk0..."
(if this is an optional entry), or "Twk1..."
(if this is a required entry). This ensures that the fields are carried over into the user home page correctly. Do not modify the version of TWikiRegistration shipped with TWiki, as your changes will be overwritten next time you upgrade.
The default new user template page is in System.NewUserTemplate. The same variables get expanded as in the template topics. You can create a custom new user home page by creating the Main.NewUserTemplate topic, which will then override the default.
- Register yourself in the TWikiRegistration topic.
Check that a new line with the username and encrypted password is added to the .htpasswd
file. If not, you may have got a path wrong, or the permissions may not allow the webserver user to write to that file.
- Create a new topic to check if authentication works.
- Edit the TWikiAdminGroup topic in the Main web to include users with system administrator status.
This is a very important step, as users in this group can access all topics, independent of TWiki access controls.
TWikiAccessControl has more information on setting up access controls.
Logons via bin/logon
Any time a user requests a page that needs authentication, they will be forced to log on. It may be convenient to have a "logon" link as well, to give the system a chance to identify the user and retrieve their personal settings. It may be convenient to force them to log on.
The
bin/logon
script enables this. If you are using Apache Login, the
bin/logon
script must be setup in the
bin/.htaccess
file to be a script which requires a
valid user
. Once authenticated, it will redirect the user to the view URL for the page from which the
logon
script was linked.
Sessions
TWiki uses the
CPAN:CGI::Session and
CPAN:CGI::Cookie modules to track sessions. These modules are de facto standards for session management among Perl programmers. If you can't use Cookies for any reason,
CPAN:CGI::Session also supports session tracking using the client IP address.
You don't
have to enable sessions to support logins in TWiki. However it is
strongly recommended. TWiki needs some way to remember the fact that you logged in from a particular browser, and it uses sessions to do this. If you don;t enable sessions, TWiki will try hard to remember you, but due to limitations in the browsers it may also forget you (and then suddenly remember you again later!). So for the best user experience, you should enable sessions.
There are a number of
TWikiVariables available that you can use to interrogate your current session. You can even add your own session variables to the TWiki cookie. Session variables are referred to as "sticky" variables.
Getting, Setting, and Clearing Session Variables
You can get, set, and clear session variables from within TWiki web pages or by using script parameters. This allows you to use the session as a personal "persistent memory space" that is not lost until the web browser is closed. Also note that if a session variable has the same name as a TWiki preference, the session variables value takes precedence over the TWiki preference.
This allows for per-session preferences.
To make use of these features, use the tags:
%SESSION_VARIABLE{ "varName" }%
%SESSION_VARIABLE{ "varName" set="varValue" }%
%SESSION_VARIABLE{ "varName" clear="" }%
Note that you
cannot override access controls preferences this way.
Cookies and Transparent Session IDs
TWiki normally uses cookies to store session information on a client computer. Cookies are a common way to pass session information from client to server. TWiki cookies simply hold a unique session identifier that is used to look up a database of session information on the TWiki server.
For a number of reasons, it may not be possible to use cookies. In this case, TWiki has a fallback mechanism; it will automatically rewrite every internal URL it sees on pages being generated to one that also passes session information.
TWiki Username vs. Login Username
This section applies only if you are using authentication with existing login names (i.e. mapping from login names to
WikiNames).
CTSPedia internally manages two usernames: Login Username and TWiki Username.
- Login Username: When you login to the intranet, you use your existing login username, ex:
pthoeny
. This name is normally passed to TWiki by the REMOTE_USER
environment variable, and used internally. Login Usernames are maintained by your system administrator.
- TWiki Username: Your name in WikiNotation, ex:
PeterThoeny
, is recorded when you register using TWikiRegistration; doing so also generates a personal home page in the Main web.
TWiki can automatically map an Intranet (Login) Username to a TWiki Username if the {AllowLoginName} is enabled in
configure. The default is to use your
WikiName as a login name.
NOTE: To correctly enter a WikiName - your own or someone else's - be sure to include the Main web name in front of the Wiki username, followed by a period, and no spaces, for example Main.WikiUsername
or %USERSWEB%.WikiUsername
. This points WikiUsername
to the Main web, where user home pages are located, no matter which web it's entered in. Without the web prefix, the name appears as a NewTopic? everywhere but in the Main web.
Changing Passwords
If your {PasswordManager} supports password changing, you can change and reset passwords using forms on regular pages.
Changing E-mail Addresses
If the active {PasswordManager} supports storage and retrieval of user e-mail addresses, you can change your e-mail using a regular page. As shipped, this is true only for the Apache 'htpasswd' password manager.
Controlling access to individual scripts
You may want to add or remove scripts from the list of scripts that require authentication. The method for doing this is different for each of Template Login and Apache Login.
- For Template Login, update the {AuthScripts} list using configure
- For Apache Login, add/remove the script from
.htaccess
How to choose an authentication method
One of the key features of TWiki is that it is possible to add HTML to topics. No authentication method is 100% secure on a website where end users can add HTML, as there is always a risk that a malicious user can add code to a topic that gathers user information, such as session IDs. The TWiki developers have been forced to make certain tradeoffs, in the pursuit of efficiency, that may be exploited by a hacker.
This section discusses some of the known risks. You can be sure that any potential hackers have read this section as well!
At one extreme, the most secure method is to use TWiki via SSL (Secure Sockets Layer), with a login manager installed and Client Sessions turned
off.
Using TWiki with sessions turned off is a pain, though, as with all the login managers there are occasions where TWiki will forget who you are. The best user experience is achieved with sessions turned
on.
As soon as you allow the server to maintain information about a logged-in user, you open a door to potential attacks. There are a variety of ways a malicious user can pervert TWiki to obtain another users session ID, the most common of which is known as a
cross-site scripting attack. Once a hacker has an SID they can pretend to be that user.
To help prevent these sorts of attacks, TWiki supports
IP matching, which ensures that the IP address of the user requesting a specific session is the same as the IP address of the user who created the session. This works well as long as IP addresses are unique to each client, and as long as the IP address of the client can't be faked.
Session IDs are usually stored by TWiki in cookies, which are stored in the client browser. Cookies work well, but not all environments or users permit cookies to be stored in browsers. So TWiki also supports two other methods of determining the session ID. The first method uses the client IP address to determine the session ID. The second uses a rewriting method that rewrites local URLs in TWiki pages to include the session ID in the URL.
The first method works well as long as IP addresses are
unique to each individual client, and client IP addresses can't be faked by a hacker. If IP addresses are unique and can't be faked, it is almost as secure as cookies + IP matching, so it ranks as the
fourth most secure method.
If you have to turn IP matching off, and cookies can't be relied on, then you may have to rely on the second method, URL rewriting. This method exposes the session IDs very publicly, so should be regarded as "rather dodgy".
Most TWiki sites don't use SSL, so, as is the case with
most sites that don't use SSL, there is always a possibility that a password could be picked out of the aether. Browsers do not encrypt passwords sent over non-SSL links, so using Apache Login is no more secure than Template Login.
Of the two shipped login managers, Apache Login is probably the most useful. It lets you do this sort of thing: wget --http-user=RogerRabbit --http-password=i'mnottelling http://www.example.com/bin/save/Sandbox/StuffAUTOINC0?text=hohoho,%20this%20is%20interesting i.e. pass in a user and password to a request from the command-line. However it doesn't let you log out.
Template Login degrades to url re-writing when you use a client like dillo that does not support cookies. However, you can log out and back in as a different user.
Finally, it would be really neat if someone was to work out how to use certificates to identify users.....
See
TWiki:TWiki.SecuringTWikiSite for more information.
Back to top
Wiki Access Control
Restricting read and write access to topics and webs, by Users and groups
Wiki Access Control allows you restrict access to single topics and entire webs, by individual user and by user Groups. Access control, combined with
Wiki User Authentication, lets you easily create and manage an extremely flexible, fine-grained privilege system.
- TWiki System Requirements
- TWiki Installation Guide
- TWiki Upgrade Guide
- Wiki User Authentication
- Wiki Access Control
- Raw Edit Formatting or Wiki Text Formatting
- Wiki Variables
- TWiki Formatted Search
- File Attachments
- TWiki Forms
- TWiki Templates
- TWiki Skins
- TWiki Meta Data
- TWiki Add-Ons
- TWiki Contribs
- TWiki Plugins
- Overview
- Installing Plugins
- Managing Installed Plugins
- The TWiki Plugin API
- Creating Plugins
- Recommended Storage of Plugin Specific Data
- Integrating with
configure
- Maintaining Plugins
- Environment
- Preferences
- User Handling and Access Control
- Webs, Topics and Attachments
- getListOfWebs( $filter ) -> @webs
- webExists( $web ) -> $boolean
- createWeb( $newWeb, $baseWeb, $opts )
- moveWeb( $oldName, $newName )
- eachChangeSince($web, $time) -> $iterator
- getTopicList( $web ) -> @topics
- topicExists( $web, $topic ) -> $boolean
- checkTopicEditLock( $web, $topic, $script ) -> ( $oopsUrl, $loginName, $unlockTime )
- setTopicEditLock( $web, $topic, $lock )
- saveTopic( $web, $topic, $meta, $text, $options ) -> $error
- saveTopicText( $web, $topic, $text, $ignorePermissions, $dontNotify ) -> $oopsUrl
- moveTopic( $web, $topic, $newWeb, $newTopic )
- getRevisionInfo($web, $topic, $rev, $attachment ) -> ( $date, $user, $rev, $comment )
- getRevisionAtTime( $web, $topic, $time ) -> $rev
- readTopic( $web, $topic, $rev ) -> ( $meta, $text )
- readTopicText( $web, $topic, $rev, $ignorePermissions ) -> $text
- attachmentExists( $web, $topic, $attachment ) -> $boolean
- readAttachment( $web, $topic, $name, $rev ) -> $data
- saveAttachment( $web, $topic, $attachment, $opts )
- moveAttachment( $web, $topic, $attachment, $newWeb, $newTopic, $newAttachment )
- Assembling Pages
- readTemplate( $name, $skin ) -> $text
- loadTemplate ( $name, $skin, $web ) -> $text
- expandTemplate( $def ) -> $string
- writeHeader( $query, $contentLength )
- redirectCgiQuery( $query, $url, $passthru )
- addToHEAD( $id, $header )
- expandCommonVariables( $text, $topic, $web, $meta ) -> $text
- renderText( $text, $web ) -> $text
- internalLink( $pre, $web, $topic, $label, $anchor, $createLink ) -> $text
- E-mail
- Creating New Topics
- Special handlers
- Searching
- Plugin-specific file handling
- General Utilities
- StaticMethod sanitizeAttachmentName ($fname) -> ($fileName,$origName)
- Deprecated functions
- TWiki CGI and Command Line Scripts
- TWiki Site Tools
- Managing Topics
- Managing Webs
- Manage Users
- Appendix A: TWiki Development Time-line
- Appendix B: Encode URLs With UTF8
- Appendix C: TWiki CSS
An Important Control Consideration
Open, freeform editing is the essence of
WikiCulture - what makes TWiki different and often more effective than other collaboration tools. For that reason, it is strongly recommended that decisions to restrict read or write access to a web or a topic are made with great care - the more restrictions, the less Wiki in the mix. Experience shows that
unrestricted write access works very well because:
- Peer influence is enough to ensure that only relevant content is posted.
- Peer editing - the ability for anyone to rearrange all content on a page - keeps topics focused.
- In TWiki, content is transparently preserved under revision control:
- Edits can be undone by the administrator (per default a member of TWikiAdminGroup; see #ManagingGroups).
- Users are encouraged to edit and refactor (condense a long topic), since there's a safety net.
As a
collaboration guideline:
- Create broad-based Groups (for more and varied input), and...
- Avoid creating view-only Users (if you can read it, you should be able to contribute to it).
Permissions settings of the webs on this TWiki site
Please Note:
- A blank in the the above table may mean either the corresponding control is absent or commented out or that it has been set to a null value. The two conditions have dramatically different and possibly opposed semantics.
- TWikiGuest is the guest account - used by unauthenticated users.
- The TWiki web must not deny view to TWikiGuest; otherwise, people will not be able to register.
Note: Above table comes from
SitePermissions
Authentication vs. Access Control
Authentication: Identifies who a user is based on a login procedure. See
TWikiUserAuthentication.
Access control: Restrict access to content based on users and groups once a user is identified.
Users and Groups
Access control is based on the familiar concept of Users and Groups. Users are defined by their
WikiNames. They can then be organized in unlimited combinations by inclusion in one or more user Groups. For convenience, Groups can also be included in other Groups.
Managing Users
A user can create an account in
TWikiRegistration. The following actions are performed:
- WikiName and encrypted password are recorded using the password manager if authentication is enabled.
- A confirmation e-mail is sent to the user.
- A user home page with the WikiName of the user is created in the Main web.
- The user is added to the WikiUsers topic.
The default visitor name is
TWikiGuest. This is the non-authenticated user.
Managing Groups
The following describes the standard TWiki support for groups. Your local TWiki may have an alternate group mapping manager installed. Check with your TWiki administrator if you are in doubt.
Groups are defined by group topics located in the
Main
web. To create a new group, visit
TWikiGroups and enter the name of the new group ending in
Group
into the "new group" form field. This will create a new group topic with two important settings:
-
Set GROUP = < list of Users and/or Groups >
-
Set ALLOWTOPICCHANGE = < list of Users and/or Groups >
The GROUP setting is a comma-separated list of users and/or other groups. Example:
-
Set GROUP = Main.SomeUser, Main.OtherUser, Main.SomeGroup
The ALLOWTOPICCHANGE setting defines who is allowed to change the group topic; it is a comma delimited list of users and groups. You typically want to restrict that to the members of the group itself, so it should contain the name of the topic. This prevents users not in the group from editing the topic to give themselves or others access. For example, for the KasabianGroup topic write:
-
Set ALLOWTOPICCHANGE = Main.KasabianGroup
Note: TWiki has strict formatting rules. Make sure you have three spaces, an asterisk, and an extra space in front of any access control rule.
The Super Admin Group
A number of TWiki functions (for example, renaming webs) are only available to administrators. Administrators are simply users who belong to the
SuperAdminGroup. This is a standard user group, the name of which is defined by {SuperAdminGroup} setting in
configure. The default name of this group is the
TWikiAdminGroup
. The system administrator may have chosen a different name for this group if your local TWiki uses an alternate group mapping manager but for simplicity we will use the default name TWikiAdminGroup in the rest of this topic.
You can create new administrators simply by adding them to the
TWikiAdminGroup topic. For example,
-
Set GROUP = Main.ElizabethWindsor, Main.TonyBlair
A member of the Super Admin Group has unrestricted access throughout the TWiki, so only trusted staff should be added to this group.
Restricting Access
You can define who is allowed to read or write to a web or a topic. Note that some plugins may not respect access permissions.
- Restricting VIEW blocks viewing and searching of content. When you restric VIEW to a topic or web, this also restricts INCLUDE and Formatted SEARCH from showing the content of the topics.
- Restricting CHANGE blocks creating new topics, changing topics or attaching files.
- Restricting RENAME prevents renaming of topics within a web.
Note that there is an important distinction between CHANGE access and RENAME access. A user can CHANGE a topic, but thanks to version control their changes cannot be lost (the history of the topic before the change is recorded). However if a topic or web is renamed, that history may be lost. Typically a site will only give RENAME access to administrators and content owners.
Controlling access to a Web
You can define restrictions on who is allowed to view a CTSPedia web. You can restrict access to certain webs to selected Users and Groups, by:
- authenticating all webs and restricting selected webs: Topic access in all webs is authenticated, and selected webs have restricted access.
- authenticating and restricting selected webs only: Provide unrestricted viewing access to open webs, with authentication and restriction only on selected webs.
- You can define these settings in the WebPreferences topic, preferable towards the end of the topic:
-
Set DENYWEBVIEW = < comma-delimited list of Users and Groups >
-
Set ALLOWWEBVIEW = < comma-delimited list of Users and Groups >
-
Set DENYWEBCHANGE = < comma-delimited list of Users and Groups >
-
Set ALLOWWEBCHANGE = < comma-delimited list of Users and Groups >
-
Set DENYWEBRENAME = < comma-delimited list of Users and Groups >
-
Set ALLOWWEBRENAME = < comma-delimited list of Users and Groups >
If your site allows hierarchical webs, then access to sub-webs is determined from the access controls of the parent web, plus the access controls in the sub-web. So, if the parent web has
ALLOWWEBVIEW
set, this will also apply to the subweb. Also note that you will need to ensure that the parent web's
FINALPREFERENCES
does not include the access control settings listed above. Otherwise you will not be able override the parent web's access control settings in sub-webs.
Creation and renaming of sub-webs is controlled by the WEBCHANGE setting on the parent web (or ROOTCHANGE for
root webs). Renaming is additionally restricted by the setting of WEBRENAME in the web itself.
Note: If you restrict access to the Main, make sure to add the
TWikiRegistrationAgent
so that users can register. Example:
-
-
Set ALLOWWEBCHANGE = TWikiAdminGroup, TWikiRegistrationAgent
Note: For Web level access rights Setting any of these settings to an empty value has the same effect as not setting them at all. Please note that the documentation of TWiki 4.0 and earlier versions of TWiki 4.1 did not reflect the actual implementation, e.g. an empty ALLOWWEBVIEW does
not prevent anyone from viewing the web, and an an empty DENYWEBVIEW does
not allow all to view the web.
Controlling access to a Topic
- You can define these settings in any topic, preferable towards the end of the topic:
-
Set DENYTOPICVIEW = < comma-delimited list of Users and Groups >
-
Set ALLOWTOPICVIEW = < comma-delimited list of Users and Groups >
-
Set DENYTOPICCHANGE = < comma-delimited list of Users and Groups >
-
Set ALLOWTOPICCHANGE = < comma-delimited list of Users and Groups >
-
Set DENYTOPICRENAME = < comma-delimited list of Users and Groups >
-
Set ALLOWTOPICRENAME = < comma-delimited list of Users and Groups >
Remember when opening up access to specific topics within a restricted web that other topics in the web - for example, the
TWikiWebLeftBar? - may also be accessed when viewing the topics. The message you get when you are denied access should tell you what topic you were not permitted to access.
Be careful with empty values for any of these.
-
Set ALLOWTOPICVIEW =
This means the same as not setting it at all. (This was documented wrong in versions 4.0.X, 4.1.0 and 4.1.1)
-
Set DENYTOPICVIEW =
Since TWiki 4.0 this means do not deny anyone the right to view this topic. If DENYTOPICVIEW is set to an empty value anyone has access even if ALLOWTOPICVIEW or ALLOWWEBVIEW is defined. This allows to have very restrictive default access rights to an entire web and still allow individual topics to have more open access.
The same rules apply to ALLOWTOPICCHANGE/DENYTOPICCHANGE and APPLYTOPICRENAME/DENYTOPICRENAME. Setting ALLOWTOPICCHANGE or ALLOWTOPICRENAME to en empty value means the same as not defining it. Setting DENYTOPICCHANGE or DENYTOPICRENAME to an empty value means that anyone can edit or rename the topic.

If the same setting is defined multiple times the last one overrides the previous. They are not OR'ed together.
The setting to an empty has caused confusion and great debate and it has been decided that the empty setting syntax will be replaced by something which is easier to understand in a later version of TWiki. A method to upgrade will be provided. Please read the release notes carefully when you upgrade.
See "How TWiki evaluates ALLOW/DENY settings" below for more on how ALLOW and DENY interacts.
Controlling access to Attachments
Attachments are referred to directly, and are not normally indirected via TWiki scripts. This means that the above instructions for access control will
not apply to attachments. It is possible that someone may inadvertently publicise a URL that they expected to be access-controlled.
The easiest way to apply the same access control rules for attachments as apply to topics is to use the Apache
mod_rewrite
module, and configure your webserver to redirect accesses to attachments to the TWiki
viewfile
script. For example,
ScriptAlias /twiki/bin/ /filesystem/path/to/twiki/bin/
Alias /twiki/pub/ /filesystem/path/to/twiki/pub/
RewriteEngine on
RewriteCond %{REQUEST_URI} !^/+twiki/+pub/+TWiki/+.+
RewriteRule ^/+twiki/+pub/+([^/]+)/+((([^/]+)/+)+)(.+) /twiki/bin/viewfile/$1/$4?filename=$5 [L,PT]
That way all the controls that apply to the topic also apply to attachments to the topic. Other types of webserver have similar support.
Note: Images embedded in topics will load much slower since each image will be delivered by the
viewfile
script.
Controlling who can manage top-level webs
Top level webs are a special case, because they don't have a parent web with a
WebPreferences. So there has to be a special control just for the root level.
- You can define these settings in the Main.%TWIKIPREFSTOPIC% topic, preferable towards the end of the topic:
-
Set DENYROOTCHANGE = < comma-delimited list of Users and Groups >
-
Set ALLOWROOTCHANGE = < comma-delimited list of Users and Groups >
Note that you do
not require
ROOTCHANGE
access to rename an existing top-level web. You just need
WEBCHANGE
in the web itself.
How TWiki evaluates ALLOW/DENY settings
When deciding whether to grant access, TWiki evaluates the following rules in order (read from the top of the list; if the logic arrives at
PERMITTED or
DENIED that applies immediately and no more rules are applied). You need to read the rules bearing in mind that VIEW, CHANGE and RENAME access may be granted/denied separately.
- If the user is an administrator
- If DENYTOPIC is set to a list of wikinames
- people in the list will be DENIED.
- If DENYTOPIC is set to empty ( i.e. Set DENYTOPIC = )
- access is PERMITTED i.e no-one is denied access to this topic.
Attention: Use this with caution. This is deprecated and will likely change in the next release.
- If ALLOWTOPIC is set
- people in the list are PERMITTED
- everyone else is DENIED
- If DENYWEB is set to a list of wikinames
- people in the list are DENIED access
- If ALLOWWEB is set to a list of wikinames
- people in the list will be PERMITTED
- everyone else will be DENIED
- If you got this far, access is PERMITTED
Access control and INCLUDE
ALLOWTOPICVIEW and ALLOWTOPICCHANGE only applies to the topic in which the settings are defined. If a topic A includes another topic B, topic A does not inherit the access rights of the included topic B.
Examples: Topic A includes topic B
- If the included topic B has ALLOWTOPICCHANGE set to block editing for a user, it does not prevent editing the including topic A.
- If the included topic B has ALLOWTOPICVIEW set to block view for a user, the user can still view topic A but he cannot see the included topic B. He will see a message No permission to view B
Access Control quick recipes
Obfuscating Webs
Another way of hiding webs is to keep them hidden by not publishing the URL and by preventing the
all webs
search option from accessing obfuscated webs. Do so by enabling the
NOSEARCHALL
variable in
WebPreferences:
This setup can be useful to hide a new web until content its ready for deployment, or to hide view access restricted webs.
Note: Obfuscating a web without view access control is
very insecure, as anyone who knows the URL can access the web.
Restrict Access to Whole TWiki Site
For a firewalled TWiki, e.g. an intranet wiki or extranet wiki, you want to allow only invited people to access your TWiki. In this case, enable
user authentication with ApacheLogin and lock down access to the whole
twiki/bin
and
twiki/pub
directories to all but valid users. In the Apache
.htaccess
file or the appropriate
.conf
file, replace the
<FilesMatch "(attach|edit|...
section with this:
<FilesMatch ".*">
require valid-user
</FilesMatch>
If needed, you can further restrict access to selected webs with ALLOWWEBVIEW and other access control settings.
Note: With this configuration, someone with access to the site needs to register new users.
Authenticate all Webs and Restrict Selected Webs
Use the following setup to authenticate users for topic viewing in all webs and to restrict access to selected webs. Requires
TWikiUserAuthentication to be enabled.
- Set
require valid-user
on your view
script in .htaccess or the appropriate Apache .conf file. As of 4.x, this looks like: FilesMatch "(attach|edit|manage|rename|save|view|upload|mail|logon|.*auth).*"
(normally view
is not in that list).
- Restrict view access to selected Users and Groups. Set one or both of these variables in its WebPreferences topic:
-
Set DENYWEBVIEW = < list of Users and Groups >
-
Set ALLOWWEBVIEW = < list of Users and Groups >
- Note:
DENYWEBVIEW
is evaluated before ALLOWWEBVIEW
. Access is denied if the authenticated person is in the DENYWEBVIEW
list, or not in the ALLOWWEBVIEW
list. Access is granted if DENYWEBVIEW
and ALLOWWEBVIEW
are not defined.
- If you still want public users to be able to register automatically follow TWiki:TWiki.RegisterOnViewRestrictedSite.
Authenticate and Restrict Selected Webs Only
Use the following setup to provide unrestricted viewing access to open webs, with authentication only on selected webs. Requires
TWikiUserAuthentication to be enabled.
- Restrict view access to selected Users and Groups. Set one or both of these variables in its WebPreferences topic:
-
Set DENYWEBVIEW = < list of Users and Groups >
-
Set ALLOWWEBVIEW = < list of Users and Groups >
- Note:
DENYWEBVIEW
is evaluated before ALLOWWEBVIEW
. Access is denied if the authenticated person is in the DENYWEBVIEW
list, or not in the ALLOWWEBVIEW
list. Access is granted if DENYWEBVIEW
and ALLOWWEBVIEW
are not defined.
Hide Control Settings
Tip: To hide access control settings from normal browser viewing, you can put them into the
topic preference settings by clicking the link
Edit topic preference settings
under
More topic actions
menu. Preferences set in this manner are not visible in the topic text, but take effect nevertheless. Access control settings added as topic preference settings are stored in the topic meta data and they override settings defined in the topic text.
Alternatively, place them in HTML comment markers, but this exposes the access setting during ordinary editing.
<!--
* Set DENYTOPICCHANGE = Main.SomeGroup
-->
Back to top
Raw Edit Formatting or Wiki Text Formatting
Working in Wiki is as easy as typing in text. You don't need to know HTML, though you can use it if you prefer. Links to topics are created automatically when you enter
WikiWords. And Wiki shorthand gives you all the power of HTML with a simple coding system that takes no time to learn. It's all laid out below.
- TWiki System Requirements
- TWiki Installation Guide
- TWiki Upgrade Guide
- Wiki User Authentication
- Wiki Access Control
- Raw Edit Formatting or Wiki Text Formatting
- Wiki Variables
- TWiki Formatted Search
- File Attachments
- TWiki Forms
- TWiki Templates
- TWiki Skins
- TWiki Meta Data
- TWiki Add-Ons
- TWiki Contribs
- TWiki Plugins
- Overview
- Installing Plugins
- Managing Installed Plugins
- The TWiki Plugin API
- Creating Plugins
- Recommended Storage of Plugin Specific Data
- Integrating with
configure
- Maintaining Plugins
- Environment
- Preferences
- User Handling and Access Control
- Webs, Topics and Attachments
- getListOfWebs( $filter ) -> @webs
- webExists( $web ) -> $boolean
- createWeb( $newWeb, $baseWeb, $opts )
- moveWeb( $oldName, $newName )
- eachChangeSince($web, $time) -> $iterator
- getTopicList( $web ) -> @topics
- topicExists( $web, $topic ) -> $boolean
- checkTopicEditLock( $web, $topic, $script ) -> ( $oopsUrl, $loginName, $unlockTime )
- setTopicEditLock( $web, $topic, $lock )
- saveTopic( $web, $topic, $meta, $text, $options ) -> $error
- saveTopicText( $web, $topic, $text, $ignorePermissions, $dontNotify ) -> $oopsUrl
- moveTopic( $web, $topic, $newWeb, $newTopic )
- getRevisionInfo($web, $topic, $rev, $attachment ) -> ( $date, $user, $rev, $comment )
- getRevisionAtTime( $web, $topic, $time ) -> $rev
- readTopic( $web, $topic, $rev ) -> ( $meta, $text )
- readTopicText( $web, $topic, $rev, $ignorePermissions ) -> $text
- attachmentExists( $web, $topic, $attachment ) -> $boolean
- readAttachment( $web, $topic, $name, $rev ) -> $data
- saveAttachment( $web, $topic, $attachment, $opts )
- moveAttachment( $web, $topic, $attachment, $newWeb, $newTopic, $newAttachment )
- Assembling Pages
- readTemplate( $name, $skin ) -> $text
- loadTemplate ( $name, $skin, $web ) -> $text
- expandTemplate( $def ) -> $string
- writeHeader( $query, $contentLength )
- redirectCgiQuery( $query, $url, $passthru )
- addToHEAD( $id, $header )
- expandCommonVariables( $text, $topic, $web, $meta ) -> $text
- renderText( $text, $web ) -> $text
- internalLink( $pre, $web, $topic, $label, $anchor, $createLink ) -> $text
- E-mail
- Creating New Topics
- Special handlers
- Searching
- Plugin-specific file handling
- General Utilities
- StaticMethod sanitizeAttachmentName ($fname) -> ($fileName,$origName)
- Deprecated functions
- TWiki CGI and Command Line Scripts
- TWiki Site Tools
- Managing Topics
- Managing Webs
- Manage Users
- Appendix A: TWiki Development Time-line
- Appendix B: Encode URLs With UTF8
- Appendix C: TWiki CSS
Wiki Editing Shorthand
Formatting Command: | You write: | You get: |
Paragraphs: Blank lines will create new paragraphs. |
1st paragraph
2nd paragraph
|
1st paragraph
2nd paragraph
|
Headings: Three or more dashes at the beginning of a line, followed by plus signs and the heading text. One plus creates a top level heading, two pluses a second level heading, etc. The maximum heading depth is 6.
You can create a table of contents with the [[VarTOC][
- TWiki System Requirements
- TWiki Installation Guide
- TWiki Upgrade Guide
- Wiki User Authentication
- Wiki Access Control
- Raw Edit Formatting or Wiki Text Formatting
- Wiki Variables
- TWiki Formatted Search
- File Attachments
- TWiki Forms
- TWiki Templates
- TWiki Skins
- TWiki Meta Data
- TWiki Add-Ons
- TWiki Contribs
- TWiki Plugins
- Overview
- Installing Plugins
- Managing Installed Plugins
- The TWiki Plugin API
- Creating Plugins
- Recommended Storage of Plugin Specific Data
- Integrating with
configure
- Maintaining Plugins
- Environment
- Preferences
- User Handling and Access Control
- Webs, Topics and Attachments
- getListOfWebs( $filter ) -> @webs
- webExists( $web ) -> $boolean
- createWeb( $newWeb, $baseWeb, $opts )
- moveWeb( $oldName, $newName )
- eachChangeSince($web, $time) -> $iterator
- getTopicList( $web ) -> @topics
- topicExists( $web, $topic ) -> $boolean
- checkTopicEditLock( $web, $topic, $script ) -> ( $oopsUrl, $loginName, $unlockTime )
- setTopicEditLock( $web, $topic, $lock )
- saveTopic( $web, $topic, $meta, $text, $options ) -> $error
- saveTopicText( $web, $topic, $text, $ignorePermissions, $dontNotify ) -> $oopsUrl
- moveTopic( $web, $topic, $newWeb, $newTopic )
- getRevisionInfo($web, $topic, $rev, $attachment ) -> ( $date, $user, $rev, $comment )
- getRevisionAtTime( $web, $topic, $time ) -> $rev
- readTopic( $web, $topic, $rev ) -> ( $meta, $text )
- readTopicText( $web, $topic, $rev, $ignorePermissions ) -> $text
- attachmentExists( $web, $topic, $attachment ) -> $boolean
- readAttachment( $web, $topic, $name, $rev ) -> $data
- saveAttachment( $web, $topic, $attachment, $opts )
- moveAttachment( $web, $topic, $attachment, $newWeb, $newTopic, $newAttachment )
- Assembling Pages
- readTemplate( $name, $skin ) -> $text
- loadTemplate ( $name, $skin, $web ) -> $text
- expandTemplate( $def ) -> $string
- writeHeader( $query, $contentLength )
- redirectCgiQuery( $query, $url, $passthru )
- addToHEAD( $id, $header )
- expandCommonVariables( $text, $topic, $web, $meta ) -> $text
- renderText( $text, $web ) -> $text
- internalLink( $pre, $web, $topic, $label, $anchor, $createLink ) -> $text
- E-mail
- Creating New Topics
- Special handlers
- Searching
- Plugin-specific file handling
- General Utilities
- StaticMethod sanitizeAttachmentName ($fname) -> ($fileName,$origName)
- Deprecated functions
- TWiki CGI and Command Line Scripts
- TWiki Site Tools
- Managing Topics
- Managing Webs
- Manage Users
- Appendix A: TWiki Development Time-line
- Appendix B: Encode URLs With UTF8
- Appendix C: TWiki CSS
]] variable. If you want to exclude a heading from the TOC, put !! after the ---+ .
Empty headings are allowed, but won't appear in the table of contents.
|
---++ Sushi
---+++ Maguro
---+++!! Not in TOC
|
Sushi
Maguro
Not in TOC
|
Bold Text: Words get shown in bold by enclosing them in * asterisks. |
*Bold*
|
Bold
|
Italic Text: Words get shown in italic by enclosing them in _ underscores. |
_Italic_
|
Italic
|
Bold Italic: Words get shown in bold italic by enclosing them in __ double-underscores. |
__Bold italic__
|
Bold italic
|
Fixed Font: Words get shown in fixed font by enclosing them in = equal signs. |
=Fixed font=
|
Fixed font
|
Bold Fixed Font: Words get shown in bold fixed font by enclosing them in double equal signs. |
==Bold fixed==
|
Bold fixed
|
You can follow the closing bold, italic, or other ( * _ __ = == ) indicator with normal punctuation, such as commas and full stops.
Make sure there is no space between the text and the indicators.
|
_This works_,
_this does not _
|
This works, _this does not _
|
Verbatim Text: Surround code excerpts and other formatted text with <verbatim> and </verbatim> tags.
verbatim tags disable HTML code. Use <pre> and </pre> tags instead if you want the HTML code within the tags to be interpreted. NOTE: Preferences variables (* Set NAME = value) are set within verbatim tags. |
<verbatim>
class CatAnimal {
void purr() {
<code here>
}
}
</verbatim>
|
class CatAnimal {
void purr() {
<code here>
}
}
|
Separator (Horizontal Rule): Three or more three dashes at the beginning of a line.. |
-------
|
|
Bulleted List: Multiple of three spaces, an asterisk, and another space.
For all the list types, you can break a list item over several lines by indenting lines after the first one by at least 3 spaces. |
* level 1
* level 2
* back on 1
* A bullet
broken over
three lines
* last bullet
|
- level 1
- back on 1
- A bullet broken over three lines
- last bullet
|
Numbered List: Multiple of three spaces, a type character, a dot, and another space. Several types are available besides a number:
Type |
Generated Style |
Sample Sequence |
1. |
Arabic numerals |
1, 2, 3, 4... |
A. |
Uppercase letters |
A, B, C, D... |
a. |
Lowercase letters |
a, b, c, d... |
I. |
Uppercase Roman Numerals |
I, II, III, IV... |
i. |
Lowercase Roman Numerals |
i, ii, iii, iv... |
|
1. Sushi
1. Dim Sum
1. Fondue
A. Sushi
A. Dim Sum
A. Fondue
i. Sushi
i. Dim Sum
i. Fondue
|
- Sushi
- Dim Sum
- Fondue
- Sushi
- Dim Sum
- Fondue
- Sushi
- Dim Sum
- Fondue
|
Definition List: Three spaces, a dollar sign, the term, a colon, a space, followed by the definition.
Deprecated syntax: Three spaces, the term with no spaces, a colon, a space, followed by the definition.
|
$ Sushi: Japan
$ Dim Sum: S.F.
|
- Sushi
- Japan
- Dim Sum
- S.F.
|
Table: Each row of the table is a line containing of one or more cells. Each cell starts and ends with a vertical bar '|'. Any spaces at the beginning of a line are ignored.
-
| *bold* | header cell with text in asterisks
-
| center-aligned | cell with at least two, and equal number of spaces on either side
-
| right-aligned | cell with more spaces on the left
-
| 2 colspan || and multi-span columns with multiple |'s right next to each other
-
|^| cell with caret indicating follow-up row of multi-span rows
- You can split rows over multiple lines by putting a backslash
'\' at the end of each line
- Contents of table cells wrap automatically as determined by the browser
- Use
%VBAR% or | to add | characters in tables.
- Use
%CARET% or ^ to add ^ characters in tables.
The TablePlugin provides the |^| multiple-span row functionality and additional rendering features |
| *L* | *C* | *R* |
| A2 | B2 | C2 |
| A3 | B3 | C3 |
| multi span |||
| A5-7 | 5 | 5 |
|^| six | six |
|^| seven | seven |
| split\
| over\
| 3 lines |
| A9 | B9 | C9 |
|
L |
C |
R |
A2 |
B2 |
C2 |
A3 |
B3 |
C3 |
multi span |
A5-7 |
5 |
5 |
six |
six |
seven |
seven |
split |
over |
3 lines |
A9 |
B9 |
C9 |
|
WikiWord Links: CapitalizedWordsStuckTogether (or WikiWords) will produce a link automatically if preceded by whitespace or parenthesis.
If you want to link to a topic in a different web write Otherweb.TopicName . To link to a topic in a subweb write Otherweb.Subweb.TopicName .
The link label excludes the name of the web, e.g. only the topic name is shown. As an exception, the name of the web is shown for the WebHome topic.
Dots '.' are used to separate webs and subwebs from topic names and therefore cannot be used in topic names.
It's generally a good idea to use the TWikiVariables %SYSTEMWEB% and %USERSWEB% instead of TWiki and Main.
|
WebStatistics
Sandbox.WebNotify
Sandbox.WebHome
Sandbox.Subweb.TopicName
|
WebStatistics
WebNotify
Sandbox
TopicName
|
Anchors: You can define a reference inside a TWiki topic (called an anchor name) and link to that. To define an anchor write #AnchorName at the beginning of a line. The anchor name must be a WikiWord of no more than 32 characters. To link to an anchor name use the [[MyTopic#MyAnchor]] syntax. You can omit the topic name if you want to link within the same topic. |
[[WikiWord#NotThere]]
[[#MyAnchor][Jump]]
#MyAnchor To here
|
WikiWord#NotThere
Jump
To here
|
#HeRe Forced Links: You can create a forced internal link by enclosing words in double square brackets.
Text within the brackets may contain optional spaces; the topic name is formed by capitalizing the initial letter and by removing the spaces; for example, [[text formatting FAQ]] links to topic TextFormattingFAQ. You can also refer to a different web and use anchors.
To "escape" double square brackets that would otherwise make a link, prefix the leading left square bracket with an exclamation point. |
[[wiki syntax]]
[[Main.TWiki groups]]
escaped:
![[wiki syntax]]
|
wiki syntax
Main.TWiki groups
escaped: [[wiki syntax]]
|
Specific Links: You can create a link where you specify the link text and the URL separately using nested square brackets [[reference][text]] . Internal link references (e.g. WikiSyntax) and URLs (e.g. http://TWiki.org/) are both supported. The rules described under Forced Links apply for internal link references. Anchor names can be added as well, to create a link to a specific place in a topic. |
[[WikiSyntax][wiki syntax]]
[[http://gnu.org][GNU]]
|
wiki syntax
GNU
|
Prevent a Link: Prevent a WikiWord from being linked by prepending it with an exclamation point. |
!SunOS
| SunOS |
Disable Links: You can disable automatic linking of WikiWords by surrounding text with <noautolink> and </noautolink> tags.
It is possible to turn off all auto-linking with a NOAUTOLINK preferences setting. |
<noautolink>
RedHat & SuSE
</noautolink>
|
RedHat & SuSE |
Mailto Links: E-mail addresses are linked automatically. To create e-mail links that have more descriptive link text, specify subject lines or message bodies, or omit the e-mail address, you can write [[mailto:user@domain][descriptive text]] . |
a@b.com
[[mailto:a@b.com]\
[Mail]]
[[mailto:?subject=\
Hi][Hi]]
|
a@b.com
[[mailto:a@b.com] [Mail]]
Hi
|
Literal content: TWiki generates HTML code from TWiki shorthand. Experts surround anything that must be output literally in the HTML code, without the application of TWiki shorthand rules, with <literal>..</literal> tags. any HTML within literal tags must be well formed i.e. all tags must be properly closed before the end of the literal block. TWiki Variables are expanded within literal blocks. | <literal> | Not | A | Table | <literal> | | Not | A | Table | |
Protected content: Experts protect text from mangling by WYSIWYG editors using <sticky>..</sticky> tags. Sticky tags don't have any effect on normal topic display; they are only relevant when content has to be protected from a WYSIWYG editor (usually because it isn't well-formed HTML, or because it is HTML that WYSIWYG would normally filter out or modify). Protected content appears as plain text in the WYSIWYG editor. | <sticky>
<div>
This div is required
</div>
<sticky> |
This div is required
|
Using HTML
You can use most HTML tags in TWiki topics without a problem. This is useful where you want to
add some content that is formatted in a way that is not supported using
TWiki shorthand, for example,
you can write
<strike>deleted text</strike>
to get
deleted text.
There are a few usability and technical considerations to keep in mind:
- On collaboration pages, it's better not to use HTML, but to use TWiki shorthand instead - this keeps the text uncluttered and easy to edit using the plaintext editor.
- If you must use HTML, use XHTML 1.0 Transitional syntax.
- Use
<literal>..</literal>
tags around blocks of HTML to avoid accidental interpretation of TWiki shorthand within the HTML.
-
Script tags may be filtered out, at the discretion of your TWiki administrator.
Recommendations when pasting HTML from other sources (using the plain-text editor):
- Copy only text between
<body>
and </body>
tags.
- Remove all empty lines. TWiki inserts
<p />
paragraph tags on empty lines, which causes problems if done between HTML tags that do not allow paragraph tags, like for example between table tags.
- Remove leading spaces. TWiki might interpret some text as lists.
- Do not span a tag over more than one line. TWiki requires that the opening and closing angle brackets -
<...>
- of a HTML tag are on the same line, or the tag will be broken.
- In your HTML editing program, save without hard line breaks on text wrap.
When using a WYSIWYG editor, you can just copy-paste directly into the editor, and the content will
be converted to
TWiki shorthand automatically when you save.
Hyperlinks
Being able to create links without any special formatting is a core Wiki feature, made possible with
WikiWords and inline URLs.
Internal Links
- GoodStyle is a WikiWord that links to the GoodStyle topic located in the current web.
- NotExistingYet? is a topic waiting to be written. Create the topic by clicking on the ?. (Try clicking, but then, Cancel - creating the topic would wreck this example!)
External Links
-
http://...
, https://...
, ftp://...
, gopher://...
, news://...
, file://...
, telnet://...
and mailto:...@...
are linked automatically.
- E-mail addresses like
name@domain.com
are linked automatically.
-
[[Square bracket rules]]
let you easily create non-WikiWord links.
- You can also write
[[http://yahoo.com Yahoo home page]]
as an easier way of doing external links with descriptive text for the link, such as Yahoo home page.
Wiki Variables
TWiki Variables are names enclosed in percent signs that are that are expanded to some other text when the topic
is displayed. For example,
%TOPIC%
is expanded to
TWikiVariablesQuickStart.
Some variables can take arguments in curly braces - for example,
%INCLUDE{"OtherTopic" ARG="arg"}%
.
Many TWiki variables are built-in, and others are predefined for your convenience. You can also define your own
TWiki Variables at the entire site, individual web, or individual topic level. For more information,
go to
TWikiVariables
TWiki Variables are fully expanded
before any of the TWiki text formatting rules are applied.
Documentation Graphics: There are many graphics available to use in your topics. Use
%ICON{"help"}%
,
%ICON{"tip"}%
, and
%ICON{"warning"}%
to get:

,

, and

, respectively.
TWikiDocGraphics lists them all.

To "escape" a variable, prefix it with an exclamation mark. Write:
!%SOMEVARIABLE%
to get: %SOMEVARIABLE%.
Wiki Plugin Formatting Extensions
Plugins can extend the functionality of Wiki into many other areas. Currently enabled plugins on this Wiki installation,
Installed Plugins.
Common Editing Errors
Wiki formatting rules are fairly simple to use and quick to type. However, there are some things to watch out for, taken from the
TextFormattingFAQ:
- Q: Text enclosed in angle brackets like
<filename>
is not displayed. How can I show it as it is?
- A: The
'<'
and '>'
characters have a special meaning in HTML, they define HTML tags. You need to escape them, so write '<'
instead of '<'
, and '>'
instead of '>'
.
Example: Type 'prog <filename>'
to get 'prog <filename>'
.
- Q: Why is the
'&'
character sometimes not displayed?
- A: The
'&'
character has a special meaning in HTML, it starts a so called character entity, i.e. '©'
is the ©
copyright character. You need to escape '&'
to see it as it is, so write '&'
instead of '&'
.
Example: Type 'This & that'
to get 'This & that'
.
Back to top
Wiki Variables
Special text strings expand on the fly to display user data or system info
WikiVariables are text strings -
%VARIABLE%
or
%VARIABLE{ parameter="value" }%
- that expand into content whenever a topic is rendered for viewing. There are two types of variables:
- Preferences variables: Can be defined and changed by the user
- Predefined variables: Defined by the TWiki system or by Plugins (for example, the SpreadSheetPlugin introduces a
%CALC{}%
variable)
- TWiki System Requirements
- TWiki Installation Guide
- TWiki Upgrade Guide
- Wiki User Authentication
- Wiki Access Control
- Raw Edit Formatting or Wiki Text Formatting
- Wiki Variables
- TWiki Formatted Search
- File Attachments
- TWiki Forms
- TWiki Templates
- TWiki Skins
- TWiki Meta Data
- TWiki Add-Ons
- TWiki Contribs
- TWiki Plugins
- Overview
- Installing Plugins
- Managing Installed Plugins
- The TWiki Plugin API
- Creating Plugins
- Recommended Storage of Plugin Specific Data
- Integrating with
configure
- Maintaining Plugins
- Environment
- Preferences
- User Handling and Access Control
- Webs, Topics and Attachments
- getListOfWebs( $filter ) -> @webs
- webExists( $web ) -> $boolean
- createWeb( $newWeb, $baseWeb, $opts )
- moveWeb( $oldName, $newName )
- eachChangeSince($web, $time) -> $iterator
- getTopicList( $web ) -> @topics
- topicExists( $web, $topic ) -> $boolean
- checkTopicEditLock( $web, $topic, $script ) -> ( $oopsUrl, $loginName, $unlockTime )
- setTopicEditLock( $web, $topic, $lock )
- saveTopic( $web, $topic, $meta, $text, $options ) -> $error
- saveTopicText( $web, $topic, $text, $ignorePermissions, $dontNotify ) -> $oopsUrl
- moveTopic( $web, $topic, $newWeb, $newTopic )
- getRevisionInfo($web, $topic, $rev, $attachment ) -> ( $date, $user, $rev, $comment )
- getRevisionAtTime( $web, $topic, $time ) -> $rev
- readTopic( $web, $topic, $rev ) -> ( $meta, $text )
- readTopicText( $web, $topic, $rev, $ignorePermissions ) -> $text
- attachmentExists( $web, $topic, $attachment ) -> $boolean
- readAttachment( $web, $topic, $name, $rev ) -> $data
- saveAttachment( $web, $topic, $attachment, $opts )
- moveAttachment( $web, $topic, $attachment, $newWeb, $newTopic, $newAttachment )
- Assembling Pages
- readTemplate( $name, $skin ) -> $text
- loadTemplate ( $name, $skin, $web ) -> $text
- expandTemplate( $def ) -> $string
- writeHeader( $query, $contentLength )
- redirectCgiQuery( $query, $url, $passthru )
- addToHEAD( $id, $header )
- expandCommonVariables( $text, $topic, $web, $meta ) -> $text
- renderText( $text, $web ) -> $text
- internalLink( $pre, $web, $topic, $label, $anchor, $createLink ) -> $text
- E-mail
- Creating New Topics
- Special handlers
- Searching
- Plugin-specific file handling
- General Utilities
- StaticMethod sanitizeAttachmentName ($fname) -> ($fileName,$origName)
- Deprecated functions
- TWiki CGI and Command Line Scripts
- TWiki Site Tools
- Managing Topics
- Managing Webs
- Manage Users
- Appendix A: TWiki Development Time-line
- Appendix B: Encode URLs With UTF8
- Appendix C: TWiki CSS
Using Variables
To use a variable type its name. For example,
- type
%T%
to get
(a preferences variable)
- type
%TOPIC%
to get TWikiVariables
(a predefined variable)
- type
%CALC{ "$UPPER(Text)" }%
to get TEXT
(a variable defined by Plugin)
Note:
- To leave a variable unexpanded, precede it with an exclamation point, e.g. type
!%TOPIC%
to get %TOPIC%
- Variables are expanded relative to the topic they are used in, not the topic they are defined in
- Type
%ALLVARIABLES%
to get a full listing of all variables defined for a particular topic
Variable Names
Variable names must start with a letter. The following characters can be letters, numbers and the underscore '_'. You can use both upper-case and lower-case letters and you can mix the characteres. E.g.
%MYVAR%
,
%MyVar%
,
%My2ndVar%
, and
%My_Var%
are all valid variable names. Variables are case sensitive.
%MyVAR%
and
%MYVAR%
are not the same variable.
By convention all settings, predefined variables and variables used by plugins are always UPPER-CASE.
#PreferencesVariables
Preferences Variables
Unlike predefined variables, preferences variables can be defined by the user in various places.
Setting Preferences Variables
You can set variables in all the following places:
- local site level in System.TWikiPreferences
- plugin topics (see TWikiPlugins)
- local site level in Main.SitePreferences
- user level in individual user topics in Main web
- web level in WebPreferences of each web
- topic level in topics in webs
- session variables (if sessions are enabled)
Settings at higher-numbered levels override settings of the same variable at lower numbered levels, unless the variable was included in the setting of FINALPREFERENCES at a lower-numbered level, in which case it is locked at the value it has at that level.
If you are setting a variable and using it in the same topic, note that TWiki reads all the variable settings from the saved version of the topic before it displays anything. This means you can use a variable anywhere in the topic, even if you set it somewhere inconspicuous near the end.
But beware: it also means that if you change the setting of a variable you are using in the same topic,
Preview
will show the wrong thing, and you must
Save
the topic to see it correctly.
The syntax for setting Variables is the same anywhere in TWiki (on its own TWiki bullet line, including nested bullets):
[multiple of 3 spaces] * [space] Set [space] VARIABLENAME [space] = [space] value
Examples:
Spaces between the = sign and the value will be ignored. You can split a value over several lines by indenting following lines with spaces - as long as you don't try to use * as the first character on the following line.
Example: * Set VARIABLENAME = value starts here and continues here
Whatever you include in your Variable will be expanded on display, exactly as if it had been entered directly.
Example: Create a custom logo variable
- To place a logo anywhere in a web by typing
%MYLOGO%
, define the Variable on the web's WebPreferences topic, and upload a logo file, ex: mylogo.gif
. You can upload by attaching the file to WebPreferences, or, to avoid clutter, to any other topic in the same web, e.g. LogoTopic
. Sample variable setting in WebPreferences:
-
Set MYLOGO = %PUBURL%/%WEB%/LogoTopic/mylogo.gif
You can also set preferences variables on a topic by clicking the link
Edit topic preference settings
under
More topic actions
. Preferences set in this manner are not visible in the topic text, but take effect nevertheless.
Access Control Variables
These are special types of preferences variables to control access to content.
TWikiAccessControl explains these security settings in detail.
Local values for variables
Certain topics (a users home topic, web site and default preferences topics) have a problem; variables defined in those topics can have two meanings. For example, consider a user topic. A user may want to use a double-height edit box when they are editing their home topic - but
only when editing their home topic. The rest of the time, they want to have a normal edit box. This separation is achieved using
Local
in place of
Set
in the variable definition. For example, if the user sets the following in their home topic:
* Set EDITBOXHEIGHT = 10
* Local EDITBOXHEIGHT = 20
Then when they are editing any other topic, they will get a 10 high edit box. However when they are editing their home topic, they will get a 20 high edit box.
Local
can be used wherever a preference needs to take a different value depending on where the current operation is being performed.
Use this powerful feature with great care!
%ALLVARIABLES%
can be used to get a listing of the values of all variables in their evaluation order, so you can see variable scope if you get confused.
Frequently Used Preferences Variables
The following preferences variables are frequently used. They are defined in
TWikiPreferences#Miscellaneous_Settings:
-
%BR%
- line break
-
%BULLET%
- bullet sign
-
%BB%
- line break and bullet combined
-
%BB2%
- indented line break and bullet
-
%RED% text %ENDCOLOR%
- colored text (also %YELLOW%
, %ORANGE%
, %PINK%
, %PURPLE%
, %TEAL%
, %NAVY%
, %BLUE%
, %AQUA%
, %LIME%
, %GREEN%
, %OLIVE%
, %MAROON%
, %BROWN%
, %BLACK%
, %GRAY%
, %SILVER%
, %WHITE%
)
-
%H%
-
Help icon
-
%I%
-
Idea icon
-
%M%
-
Moved to icon
-
%N%
-
New icon
-
%P%
-
Refactor icon
-
%Q%
-
Question icon
-
%S%
-
Pick icon
-
%T%
-
Tip icon
-
%U%
-
Updated icon
-
%X%
-
Alert icon
-
%Y%
-
Done icon
There are additional useful preferences variables defined in
TWikiPreferences, in
Main.SitePreferences, and in
WebPreferences of every web.
Predefined Variables
Most predefined variables return values that were either set in the configuration when TWiki was installed, or taken from server info (such as current username, or date and time). Some, like
%SEARCH%
, are powerful and general tools.
-
Predefined variables can be overridden by preferences variables (except TOPIC and WEB)
-
Plugins may extend the set of predefined variables (see individual Plugins topics for details)
-
Take the time to thoroughly read through ALL preference variables. If you actively configure your site, review variables periodically. They cover a wide range of functions, and it can be easy to miss the one perfect variable for something you have in mind. For example, see %INCLUDINGTOPIC%
, %INCLUDE%
, and the mighty %SEARCH%
.
This version of TWiki - Foswiki-1.0.4, Thu, 19 Mar 2009, build 3201 - predefines the following variables:
ACTIVATEDPLUGINS -- list of currently activated plugins
- Syntax:
%ACTIVATEDPLUGINS%
- Expands to: TWikiCompatibilityPlugin, SpreadSheetPlugin, CommentPlugin, ActionTrackerPlugin, JQueryPlugin, JumpAutocompletePlugin, AntiWikiSpamPlugin, AttachmentListPlugin, BibliographyPlugin, CalendarPlugin, CheckToIncludePlugin, DirectedGraphPlugin, DpSyntaxHighlighterPlugin, EFetchPlugin, EditTablePlugin, EmbedBibPlugin, FoldingTOCPlugin, GoogleAnalyticsPlugin, InterwikiPlugin, LatexModePlugin, LightboxPlugin, PreferencesPlugin, RandomTopicPlugin, SlideShowPlugin, SmiliesPlugin, StylishPlugin, TablePlugin, TagCloudPlugin, TagMePlugin, TinyMCEPlugin, TopicDataHelperPlugin, TopicVarsPlugin, TopicVotePlugin, TreePlugin, TwistyPlugin, VotePlugin, WysiwygPlugin, ZonePlugin
- Related: PLUGINDESCRIPTIONS, FAILEDPLUGINS, PLUGINVERSION
ALLVARIABLES -- list of currently defined TWikiVariables
- Syntax:
%ALLVARIABLES%
- Expands to: a table showing all defined TWikiVariables in the current context
AQUA -- start aqua colored text
-
AQUA
is one of the rendering shortcut settings predefined in TWikiPreferences. See the section rendering shortcut settings in that topic for a complete list of colors.
- Syntax:
%AQUA% aqua text %ENDCOLOR%
- Expands to: aqua text
- Note:
%<color>%
text must end with %ENDCOLOR%
. If you want to switch from one color to another one you first need to end the active color with %ENDCOLOR%
, e.g. write %RED% some text %ENDCOLOR% %GREEN% more text %ENDCOLOR%
.
- Related: ENDCOLOR, TWikiPreferences, StandardColors
ATTACHURL -- full URL for attachments in the current topic
ATTACHURLPATH -- path of the attachment URL of the current topic
AUTHREALM -- authentication realm
- String defined as {AuthRealm} in configure. This is used in certain password encodings, and in login templates as part of the login prompt.
- Syntax:
%AUTHREALM%
- Expands to: Enter your LoginName. (Typically First name and last name, no space, no dots, capitalized, e.g. JohnSmith, unless you chose otherwise). Visit UserRegistration if you do not have one.
- Related: TWikiUserAuthentication, SESSIONID, SESSIONVAR, LOGIN, LOGOUT, SESSION_VARIABLE
BASETOPIC -- base topic where an INCLUDE started
- The name of the topic where a single or nested INCLUDE started - same as
%TOPIC%
if there is no INCLUDE
- Syntax:
%BASETOPIC%
- Related: BASEWEB, INCLUDINGTOPIC, INCLUDE, TOPIC
BASEWEB -- base web where an INCLUDE started
- 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.
- Syntax:
%BASEWEB%
- Related: BASETOPIC, INCLUDINGWEB, INCLUDE, WEB
BB -- bullet with line break
BB2 -- level 2 bullet with line break
BB3 -- level 3 bullet with line break
BB4 -- level 4 bullet with line break
BLACK -- start black colored text
-
BLACK
is one of the rendering shortcut settings predefined in TWikiPreferences. See the section rendering shortcut settings in that topic for a complete list of colors.
- Syntax:
%BLACK% black text %ENDCOLOR%
- Expands to: black text
- Note:
%<color>%
text must end with %ENDCOLOR%
. If you want to switch from one color to another one you first need to end the active color with %ENDCOLOR%
, e.g. write %RED% some text %ENDCOLOR% %GREEN% more text %ENDCOLOR%
.
- Related: ENDCOLOR, TWikiPreferences, StandardColors
BLUE -- start blue colored text
-
BLUE
is one of the rendering shortcut settings predefined in TWikiPreferences. See the section rendering shortcut settings in that topic for a complete list of colors.
- Syntax:
%BLUE% blue text %ENDCOLOR%
- Expands to: blue text
- Note:
%<color>%
text must end with %ENDCOLOR%
. If you want to switch from one color to another one you first need to end the active color with %ENDCOLOR%
, e.g. write %RED% some text %ENDCOLOR% %GREEN% more text %ENDCOLOR%
.
- Related: ENDCOLOR, TWikiPreferences, StandardColors
BR -- line break
BROWN -- start brown colored text
-
BROWN
is one of the rendering shortcut settings predefined in TWikiPreferences. See the section rendering shortcut settings in that topic for a complete list of colors.
- Syntax:
%BROWN% brown text %ENDCOLOR%
- Expands to: brown text
- Note:
%<color>%
text must end with %ENDCOLOR%
. If you want to switch from one color to another one you first need to end the active color with %ENDCOLOR%
, e.g. write %RED% some text %ENDCOLOR% %GREEN% more text %ENDCOLOR%
.
- Related: ENDCOLOR, TWikiPreferences, StandardColors
BULLET -- bullet character
CALC{"formula"} -- add spreadsheet calculations to tables and outside tables
- The
%CALC{"formula"}%
variable is handled by the SpreadSheetPlugin. There are around 80 formulae, such as $ABS()
, $EXACT()
, $EXISTS()
, $GET()/$SET()
, $IF()
, $LOG()
, $LOWER()
, $PERCENTILE()
, $TIME()
, $VALUE()
.
- Syntax:
%CALC{"formula"}%
- Examples:
-
%CALC{"$SUM($ABOVE())"}%
returns the sum of all cells above the current cell
-
%CALC{"$EXISTS(Web.SomeTopic)"}%
returns 1
if the topic exists
-
%CALC{"$UPPER(Collaboration)"}%
returns COLLABORATION
- Related: IF, SpreadSheetPlugin
CARET -- caret symbol
COMMENT{ attributes } -- insert an edit box into the topic to easily add comments.
- A
%COMMENT%
without parameters shows a simple text box.
- The following standard attributes are recognized
Name | Description | Default |
type | This is the name of the template to use for this comment. Comment templates are defined in a TWiki template - see Customisation, below. If this attribute is not defined, the type is whatever is defined by COMMENTPLUGIN_DEFAULT_TYPE, either in this topic or in your WebPreferences. | below |
default | Default text to put into the textarea of the prompt. | |
target | Name of the topic to add the comment to | the current topic |
location | Regular expression specifying the comment location in the target topic. Read carefully the CommentPlugin documentation! | |
mode | For compatibility with older versions only, synonymous with type | |
nonotify | Set to "on" to disable change notification for target topics | off |
noform | Set to "on" to disable the automatic form that encloses your comment block - remember to insert <form> tags yourself! See CommentPluginExamples#noform for an example. | off |
nopost | Set to "on" to disable insertion of the posted text into the topic. | off |
remove | Set to "on" to remove the comment prompt after the first time it is clicked. | off |
button | Button label text | Add comment |
DATE -- signature format date
DISPLAYTIME -- display date and time
- Syntax:
%DISPLAYTIME%
- Expands to:
24 Jan 2021 - 23:27
- Date part of the format is displayed as defined by the {DefaultDateFormat} in configure. The time is shown as hh:mm (24 hour clock)
- Related: DISPLAYTIME{"format"}, GMTIME, SERVERTIME
DISPLAYTIME{"format"} -- formatted display time
- Formatted time - either GMT or Local server time, depending on {DisplayTimeValues} setting in configure. Same format qualifiers as
%GMTIME%
- Syntax:
%DISPLAYTIME{"format"}%
- Example:
%DISPLAYTIME{"$hou:$min"}%
expands to 23:27
- Related: DISPLAYTIME, GMTIME, SERVERTIME
EDITACTION -- Selects an edit template
- EDITACTION defined in a topic or preference setting will define the use of an editaction template instead of the standard edit. If EDITACTION is defined as
text
, then hide the form. If EDITACTION is defined as form
hide the normal text area and only edit the form.
- Syntax: Set EDITACTION = text|form
- Expands to: %EDITACTION%
- Related: TWikiScripts#edit
-
When EDITACTION is defined as text or form the Edit and Edit Raw buttons simply add ;action=text
or ;action=form
to the URL for the edit script. If you have defined EDITACTION in a topic setting or preference setting you can still edit the topic content or the form by removing the ;action=form
or ;action=text
from the edit URL in the browser and reload.
EDITTABLE{ attributes } -- edit TWiki tables using edit fields and other input fields
- The
%EDITTABLE{}%
variable is handled by the EditTablePlugin
- Syntax:
%EDITTABLE{ attributes }%
- Supported attributes:
Attribute | Comment | Default |
header | Specify the header format of a new table like " | Food | Drink | ". Useful to start a table with only a button | (no header) |
format | The format of one column when editing the table. A cell can be a text input field, or any of these edit field types: • Text input field (1 line): = | text, <size>, <initial value> | = • Textarea input field: = | textarea, <rows>x<columns>, <initial value> | = • Drop down box: = | select, <size>, <option 1>, <option 2>, etc* | = * only one item can be selected • Radio buttons: = | radio, <size*>, <option 1>, <option 2>, etc | = * size indicates the number of buttons per line in edit mode • Checkboxes: = | checkbox, <size*>, <option 1>, <option 2>, etc | = * size indicates the number of checkboxes per line in edit mode • Fixed label: = | label, 0, <label text> | = • Row number: = | row, <offset> | = • Date: = | date, <size>, <initial value>, <DHTML date format> | = (see Date Field Type) | "text, 16" for all cells |
changerows | Rows can be added and removed if "on" Rows can be added but not removed if "add" Rows cannot be added or removed if "off" | CHANGEROWS plugin setting |
quietsave | Quiet Save button is shown if "on" , hidden if "off" | QUIETSAVE plugin setting |
include | Other topic defining the EDITTABLE parameters. The first %EDITTABLE% in the topic is used. This is useful if you have many topics with the same table format and you want to update the format in one place. | (none) |
helptopic | Topic name containing help text shown below the table when editing a table. The %STARTINCLUDE% and %STOPINCLUDE% variables can be used in the topic to specify what is shown. | (no help text) |
headerislabel | Table header cells are read-only (labels) if "on" ; header cells can be edited if "off" or "0" | "on" |
editbutton | Set edit button text, e.g. "Edit this table" ; set button image with alt text, e.g. "Edit table, %PUBURL%/%TWIKIWEB%/TWikiDocGraphics/edittopic.gif" ; hide edit button at the end of the table with "hide" (Note: Button is automatically hidden if an edit button is present in a cell) | EDITBUTTON plugin setting |
javascriptinterface | Use javascript to directly move and delete row without page refresh. Enable with "on" , disable with "off" . | JAVASCRIPTINTERFACE plugin setting |
- Example:
%EDITTABLE{ format="| text, 20 | select, 1, one, two, three |" changerows="on" }%
| *Name* | *Type* |
| Foo | two |
- Related: See EditTablePlugin for more details
ENCODE{"string"} -- encodes a string to HTML entities
- Encode "special" characters to HTML numeric entities. Encoded characters are:
- all non-printable ASCII characters below space, except newline (
"\n"
) and linefeed ("\r"
)
- HTML special characters
"<"
, ">"
, "&"
, single quote ('
) and double quote ("
)
- TWiki special characters
"%"
, "["
, "]"
, "@"
, "_"
, "*"
, "="
and "|"
- Syntax:
%ENCODE{"string"}%
- Supported parameters:
Parameter: | Description: | Default: |
"string" | String to encode | required (can be empty) |
type="entity" | Encode special characters into HTML entities, like a double quote into " . Does not encode \n or \r . | type="url" |
type="html" | As type="entity" except it also encodes \n and \r | type="url" |
type="quotes" | Escape double quotes with backslashes (\" ), does not change other characters | type="url" |
type="url" | Encode special characters for URL parameter use, like a double quote into %22 | (this is the default) |
- Example:
%ENCODE{"spaced name"}%
expands to spaced%20name
-
Note: Values of HTML input fields must be entity encoded.
Example: <input type="text" name="address" value="%ENCODE{ "any text" type="entity" }%" />
-
Note: Double quotes in strings must be escaped when passed into other TWiki variables.
Example: %SEARCH{ "%ENCODE{ "string with "quotes"" type="quotes" }%" noheader="on" }%
ENDCOLOR -- end colored text
-
ENDCOLOR
is a rendering shortcut settings predefined in TWikiPreferences. See the section rendering shortcut settings in that topic for a complete list of colors.
- Syntax:
%RED% red text %ENDCOLOR%
- Expands to: red text
- Note:
%<color>%
text must end with %ENDCOLOR%
. If you want to switch from one color to another one you first need to end the active color with %ENDCOLOR%
, e.g. write %RED% some text %ENDCOLOR% %GREEN% more text %ENDCOLOR%
.
- Related: VarAQUA, VarBLACK, VarBLUE, VarBROWN, VarGRAY, VarGREEN, VarLIME, VarMAROON, VarNAVY, VarOLIVE, VarORANGE, VarPINK, VarPURPLE, VarRED, VarSILVER, VarTEAL, VarWHITE, VarYELLOW, TWikiPreferences, StandardColors
ENDSECTION{"name"} -- marks the end of a named section within a topic
- Syntax:
%ENDSECTION{"name"}%
- Syntax:
%ENDSECTION{type="include"}%
- Supported parameter:
Parameter: | Description: |
"name" | Name of the section. |
type="..." | Type of the section being terminated; supported types "section" , "include" , "templateonly" . |
- If the
STARTSECTION
is named, the corresponding ENDSECTION
must also be named with the same name. If the STARTSECTION
specifies a type, then the corresponding ENDSECTION
must also specify the same type. If the section is unnamed, ENDSECTION
will match with the nearest unnamed %STARTSECTION%
of the same type above it.
- Related: STARTSECTION
ENV{"varname"} -- inspect the value of an environment variable
- Returns the current value of the environment variable in the CGI (Common Gateway Interface) environment. This is the environment that the TWiki scripts run in on the web server.
- Note: For security reasons, only those variables whose names match the regular expression in
{AccessibleENV}
in the Security Settings/Miscellaneous section of configure
can be displayed. Any other variable will just be shown as an empty string, irrespective of its real value.
- Example:
%ENV{MOD_PERL}%
displays as: mod_perl/2.0.4
- If a variable is undefined (as against being set to the empty string) it will be returned as
not set
.
- Related: HTTP_HOST, REMOTE_ADDR, REMOTE_PORT, REMOTE_USER
FAILEDPLUGINS -- debugging for plugins that failed to load, and handler list
FORMFIELD{"fieldname"} -- renders a field in the form attached to some topic
- Syntax:
%FORMFIELD{"fieldname"}%
- Supported parameters:
Parameter: | Description: | Default: |
"fieldname" | The name of a TWiki form field | required |
topic="..." | Topic where form data is located. May be of the form Web.TopicName | Current topic |
format="..." | Format string. $value expands to the field value, and $title expands to the fieldname (also expands $name, $attributes, $type, $size and $definingTopic) | "$value" |
default="..." | Text shown when no value is defined for the field | "" |
alttext="..." | Text shown when field is not found in the form | "" |
- Example:
%FORMFIELD{"ProjectName" topic="Projects.SushiProject" default="(not set)" alttext="ProjectName field found"}%
- Related: SEARCH
GMTIME -- GM time
GMTIME{"format"} -- formatted GM time
- Syntax:
%GMTIME{"format"}%
- Supported variables:
Variable: | Unit: | Example |
$seconds | seconds | 59 |
$minutes | minutes | 59 |
$hours | hours | 23 |
$day | day of month | 31 |
$wday | day of the Week (Sun, Mon, Tue, Wed, Thu, Fri, Sat) | Thu |
$dow | day of the week (Sun = 0) | 2 |
$week | number of week in year (ISO 8601) | 34 |
$month | short name of month | Dec |
$mo | 2 digit month | 12 |
$year | 4 digit year | 1999 |
$ye | 2 digit year | 99 |
$tz | either "GMT" (if set to gmtime), or "Local" (if set to servertime) | GMT |
$iso | ISO format timestamp | 2021-01-25T05:27:07Z |
$rcs | RCS format timestamp | 2021/01/25 05:27:07 |
$http | E-mail & http format timestamp | Mon, 25 Jan 2021 05:27:07 GMT |
$epoch | Number of seconds since 00:00 on 1st January, 1970 | 1611552427 |
- Variables can be shortened to 3 characters
- Example:
%GMTIME{"$day $month, $year - $hour:$min:$sec"}%
expands to 25 Jan, 2021 - 05:27:07
-
Note: When used in a template topic, this variable will be expanded when the template is used to create a new topic. See TWikiTemplates#TemplateTopicsVars for details.
- Related: DISPLAYTIME, GMTIME, REVINFO, SERVERTIME
GRAY -- start gray colored text
-
GRAY
is one of the rendering shortcut settings predefined in TWikiPreferences. See the section rendering shortcut settings in that topic for a complete list of colors.
- Syntax:
%GRAY% gray text %ENDCOLOR%
- Expands to: gray text
- Note:
%<color>%
text must end with %ENDCOLOR%
. If you want to switch from one color to another one you first need to end the active color with %ENDCOLOR%
, e.g. write %RED% some text %ENDCOLOR% %GREEN% more text %ENDCOLOR%
.
- Related: ENDCOLOR, TWikiPreferences, StandardColors
GREEN -- start green colored text
-
GREEN
is one of the rendering shortcut settings predefined in TWikiPreferences. See the section rendering shortcut settings in that topic for a complete list of colors.
- Syntax:
%GREEN% green text %ENDCOLOR%
- Expands to: green text
- Note:
%<color>%
text must end with %ENDCOLOR%
. If you want to switch from one color to another one you first need to end the active color with %ENDCOLOR%
, e.g. write %RED% some text %ENDCOLOR% %GREEN% more text %ENDCOLOR%
.
- Related: ENDCOLOR, TWikiPreferences, StandardColors
GROUPS -- a formatted list of groups
H -- help icon
- Type: Preference variable - TWikiRenderingShortcut.
- Current value: H =
- Related: I, ICON, M, N, P, Q, S, T, U, X, Y
HOLIDAYLIST -- add a vacation list to a topic
HOMETOPIC -- home topic in each web
HTTP -- get HTTP headers
HTTP_HOST -- environment variable
HTTPS -- get HTTPS headers
- The same as
%HTTP%
but operates on the HTTPS environment variables present when the SSL protocol is in effect. Can be used to determine whether SSL is turned on.
- Syntax:
%HTTPS%
- Syntax:
%HTTPS{"Header-name"}%
- Related: HTTP, REMOTE_ADDR, REMOTE_PORT, REMOTE_USER
I -- idea icon
- Type: Preference variable - TWikiRenderingShortcut.
- Current value: I =
- Related: H, ICON, M, N, P, Q, S, T, U, X, Y
ICON{"name"} -- small documentation graphic or icon of common attachment types
- Generates the HTML img tag of a small graphic image attached to TWikiDocGraphics. Images typically have a 16x16 pixel size. You can select a specific image by name, or you can give a full filename, in which case the type of the file will be used to select one of a collection of common file type icons.
- Syntax:
%ICON{"name"}%
- Examples:
-
%ICON{"flag-gray"}%
returns
-
%ICON{"pdf"}%
returns
-
%ICON{"smile.pdf"}%
returns
-
%ICON{"/dont/you/dare/smile.pdf"}%
returns
-
%ICON{"http://twiki.org/doc/xhtml.xsl"}%
returns
- Graphic samples:
arrowbright
,
bubble
,
choice-yes
,
hand
- File type samples:
bmp
,
doc
,
gif
,
hlp
,
html
,
mp3
,
pdf
,
ppt
,
txt
,
xls
,
xml
,
zip
- Related: ICONURL, ICONURLPATH, DefaultPreferences, FileAttachments, TWikiDocGraphics
ICONURL{"name"} -- URL of small documentation graphic or icon
- Generates the full URL of a TWikiDocGraphics image, which TWiki renders as an image. The related
%ICON{"name"}%
generates the full HTML img tag. Specify image name or full filename (see ICON for details on filenames.)
- Syntax:
%ICONURL{"name"}%
- Examples:
-
%ICONURL{"arrowbright"}%
returns https://www.ctspedia.org/wiki/pub/System/DocumentGraphics/arrowbright.gif
-
%ICONURL{"novel.pdf"}%
returns https://www.ctspedia.org/wiki/pub/System/DocumentGraphics/pdf.gif
-
%ICONURL{"/queen/boheme.mp3"}%
returns https://www.ctspedia.org/wiki/pub/System/DocumentGraphics/mp3.gif
- Related: ICONURLPATH, ICON, DefaultPreferences, FileAttachments, TWikiDocGraphics
ICONURLPATH{"name"} -- URL path of small documentation graphic or icon
- Generates the URL path of a TWikiDocGraphics image, typically used in an HTML img tag. Specify image name or full filename (see ICON for details on filenames.)
- Syntax:
%ICONURLPATH{"name"}%
- Examples:
-
%ICONURLPATH{"locktopic"}%
returns /wiki/pub/System/DocumentGraphics/locktopic.gif
-
%ICONURLPATH{"eggysmell.xml"}%
returns /wiki/pub/System/DocumentGraphics/xml.gif
-
%ICONURLPATH{"/doc/xhtml.xsl"}%
returns /wiki/pub/System/DocumentGraphics/xsl.gif
- Related: ICONURL, ICON, DefaultPreferences, FileAttachments, TWikiDocGraphics
IF{"condition" ...} -- simple conditionals
- Evaluate a condition and show one text or another based on the result. See details in IfStatements
- Syntax:
%IF{"CONDITION" then="THEN" else="ELSE"}%
shows "THEN"
if "CONDITION"
evaluates to TRUE
, otherwise "ELSE"
will be shown
- Example:
%IF{"defined FUNFACTOR" then="FUNFACTOR is defined" else="FUNFACTOR is not defined"}%
renders as FUNFACTOR is not defined
- Related: $IF() of SpreadSheetPlugin
INCLUDE{"page"} -- include other topic or web page
- Syntax:
%INCLUDE{"page" ...}%
- Supported parameters:
Parameter: | Description: | Default: |
"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{"System.SiteMap"}% | |
"http://..." | A full qualified URL, i.e. %INCLUDE{"http://twiki.org:80/index.html"}% . Supported content types are text/html and text/plain . if the URL resolves to an attachment file on the server this will automatically translate to a server-side include. | |
pattern="..." | Include a subset of a topic or a web page. Specify a RegularExpression that scans from start ('^' ) to end and contains the text you want to keep in parenthesis, e.g., pattern="^.*?(from here.*?to here).*" . IncludeTopicsAndWebPages has more. | none |
rev="2" | Include a previous topic revision; N/A for URLs | top revision |
raw="on" | When a page is included, normally CTSPedia will process it, doing the following: 1) Alter relative links to point back to originating host, 2) Remove some basic HTML tags (html, head, body, script) and finally 3) Remove newlines from HTML tags spanning multiple lines. If you prefer to include exactly what is in the source of the originating page set this to on . raw="on" is short for disableremoveheaders="on" , disableremovescript="on" , disableremovebody="on" , disablecompresstags="on" and disablerewriteurls="on" . | disabled |
literal="on" | While using the raw option will indeed include the raw content, the included content will still be processed and rendered like regular topic content. To disable parsing of the included content, set the literal option to "on" . | disabled |
disableremoveheaders="on" | Bypass stripping headers from included HTML (everything until first </head> tag) | disabled |
disableremovescript="on" | Bypass stripping all <script> tags from included HTML | disabled |
disableremovebody="on" | Bypass stripping the </body> tag and everything around over and below it | disabled |
disablecompresstags="on" | Bypass replacing newlines in HTML tags with spaces. This compression step rewrites unmatched <'s into < entities unless bypassed | disabled |
disablerewriteurls="on" | Bypass rewriting relative URLs into absolute ones | disabled |
warn="off" | Warn if topic include fails: Fail silently (if off ); output default warning (if set to on ); else, output specific text (use $topic for topic name) | %INCLUDEWARNING% preferences setting |
section="name" | Includes only the specified named section, as defined in the included topic by the STARTSECTION and ENDSECTION variables. Nothing is shown if the named section does not exists. section="" is equivalent to not specifying a section | |
PARONE="val 1" PARTWO="val 2" | Any other parameter will be defined as a variable within the scope of the included topic. The example parameters on the left will result in %PARONE% and %PARTWO% being defined within the included topic. | |
- Note: JavaScript in included webpages is filtered out as a security precaution per default (disable filter with
disableremovescript
parameter)
- Examples: See IncludeTopicsAndWebPages
- Related: BASETOPIC, BASEWEB, INCLUDINGTOPIC, INCLUDINGWEB, STARTINCLUDE, STOPINCLUDE, STARTSECTION, ENDSECTION
INCLUDINGTOPIC -- name of topic that includes current topic
- The name of the topic that includes the current topic - same as
%TOPIC%
in case there is no include
- Syntax:
%INCLUDINGTOPIC%
- Related: BASETOPIC, INCLUDINGWEB, INCLUDE, TOPIC
INCLUDINGWEB -- web that includes current topic
- The web name of the topic that includes the current topic - same as
%WEB%
if there is no INCLUDE.
- Syntax:
%INCLUDINGWEB%
- Related: BASEWEB, INCLUDINGTOPIC, INCLUDE, WEB
KINOSEARCH tag
If
SearchEngineKinoSearchPlugin is enabled, you will be able to use the KINOSEARCH tag to search indexed topics and attachments:
-
%KINOSEARCH{'Search String' format='Formatting string'}%
format takes the following variables to place content.
- $icon - An icon to display filetype when showing attachments
- $match - The Twiki Name of the page being displayed
- $locked - Show if a page is locked
- $texthead - Summary text
See:
SearchEngineKinoSearchAddOn and
SearchEngineKinoSearchPlugin
LANGUAGE -- current user's language
- Returns the language code for the language used as the current user. This is the language actually used by TWiki Internationalization (e.g. in user interface).
- The language is detected from the user's browser, unless some site/web/user/session-defined setting overrides it:
- If the
LANGUAGE
preference is set, it's used as user's language instead of any language detected from the browser.
- Avoid defining
LANGUAGE
at a non per-user way, so each user can choose his/her preferred language.
- Related: LANGUAGES
LANGUAGES -- list available TWiki languages
- List the languages available (as
PO
files) to TWiki. Those are the languages in which TWiki's user interface is available.
- Syntax:
%LANGUAGES{...}%
- Supported parameters:
Parameter: | Description: | Default: |
format | format for each item. See below for variables available in the format string. | " * $langname" |
separator | separator between items. | "\n" (newline) |
marker="selected" | Text for $marker if the item matches selection | "selected" |
selection="%LANGUAGE%" | Current language to be selected in list | (none) |
-
format
variables: Variable | Meaning |
$langname | language's name, as informed by the translators |
$langtag | language's tag. Ex: en , pt-br , etc. |
- Example:
<select>%LANGUAGES{format="<option $marker value='$langtag'>$langname</option>" selection="%LANGUAGE%"}%</select>
creates an option list of the available languages with the current language selected
LIME -- start lime colored text
-
LIME
is one of the rendering shortcut settings predefined in TWikiPreferences. See the section rendering shortcut settings in that topic for a complete list of colors.
- Syntax:
%LIME% lime text %ENDCOLOR%
- Expands to: lime text
- Note:
%<color>%
text must end with %ENDCOLOR%
. If you want to switch from one color to another one you first need to end the active color with %ENDCOLOR%
, e.g. write %RED% some text %ENDCOLOR% %GREEN% more text %ENDCOLOR%
.
- Related: ENDCOLOR, TWikiPreferences, StandardColors
LOCALSITEPREFS -- web.topicname of site preferences topic
- The full name of the local site preferences topic. These local site preferences overload the system level preferences defined in System.DefaultPreferences.
- Syntax:
%LOCALSITEPREFS%
- Expands to:
Main.SitePreferences
, renders as SitePreferences
LOGIN -- present a full login link
LOGOUT -- present a full logout link
M -- moved to... icon
- Type: Preference variable - TWikiRenderingShortcut.
- Current value: M =
- Related: H, I, ICON, N, P, Q, S, T, U, X, Y
MAINWEB -- synonym for USERSWEB
- Deprecated. Please use %USERSWEB% instead.
MAKETEXT -- creates text using TWiki's I18N infrastructure
- Syntax:
%MAKETEXT{"string" args="..."}%
- Supported parameters:
Parameter | Description | Default |
"text" or string="text" | The text to be displayed. | none |
args="param1, param2" | a comma-separated list of arguments to be interpolated in the string, replacing the [_N] placeholders in it. | none |
- Examples:
-
%MAKETEXT{string="Notes:"}%
expands to
Notes:
-
%MAKETEXT{"If you have any questions, please contact [_1]." args="%WIKIWEBMASTER%"}%
expands to
If you have any questions, please contact marybanachphdmph@gmail.com.
-
%MAKETEXT{"Did you want to [[[_1]][reset [_2]'s password]]?" args="%SYSTEMWEB%.ResetPassword,%WIKIUSERNAME%"}%
expands to
Did you want to reset Main.WikiGuest's password?
- Notes:
- TWiki will translate the
string
to the current user's language only if it has such string in its translation table for that language.
- Amperstands (
&
) followed by one letter (one of a...z, A...Z) (say, X
) in the translatable string will be translated to <span class='twikiAccessKey'>X</span>
. This is used to implement access keys. If you want to write an actual amperstand that stays just before a letter, write two consecutive amperstands (&&
): they will be transformed in just one.
- translatable string starting with underscores (
_
) are reserved. You cannot use translatable phrases starting with an underscore.
- Make sure that the translatable string is constant. Specially, do not include
%VARIABLES%
inside the translatable strings (since they will get expanded before the %MAKETEXT{...}%
itself is handled).
MAROON -- start maroon colored text
-
MAROON
is one of the rendering shortcut settings predefined in TWikiPreferences. See the section rendering shortcut settings in that topic for a complete list of colors.
- Syntax:
%MAROON% maroon text %ENDCOLOR%
- Expands to: maroon text
- Note:
%<color>%
text must end with %ENDCOLOR%
. If you want to switch from one color to another one you first need to end the active color with %ENDCOLOR%
, e.g. write %RED% some text %ENDCOLOR% %GREEN% more text %ENDCOLOR%
.
- Related: ENDCOLOR, TWikiPreferences, StandardColors
META -- displays meta-data
- Provided mainly for use in templates, this variable generates the parts of the topic view that relate to meta-data (attachments, forms etc.) The
formfield
item is the most likely to be useful to casual users.
- Syntax:
%META{ "item" ...}%
- Parameters:
Item | Options | Description |
"formfield" | name="..." : name of the field. The field value can be shortened as described in FormattedSearch for $formfield newline="..." : by default, each newline character will be rewritten to <br /> to allow metadata that contains newlines to be used in tables, etc. $n indicates a newline character. bar="..." : by default, each vertical bar is rewritten to an HTML entity so as to not be mistaken for a table separator. | Show a single form field |
"form" | none | Generates the table showing the form fields. See Form Templates |
"attachments" | all="on" to show hidden attachments. title="..." to show a title - only if attachments are displayed. template="..." to use a custom template for the rendering of attachments; default attachtables is used. | Generates the list of attachments |
"moved" | none | Details of any topic moves |
"parent" | dontrecurse="on" : By default recurses up tree, this has some cost. nowebhome="on" : Suppress WebHome. prefix="..." : Prefix that goes before parents, but only if there are parents, default "" . format="..." : Format string used to display each parent topic where $web expands to the web name, and $topic expands to the topic name; default: "[[$web.$topic][$topic]]" suffix="..." : Suffix, only appears if there are parents; default "" . separator="..." : Separator between parents; default " > " . | Generates the parent link |
- Related: METASEARCH
METASEARCH -- special search of meta data
- Syntax:
%METASEARCH{...}%
- Supported parameters:
Parameter: | Description: | Default: |
type="topicmoved" | What sort of search is required? "topicmoved" if search for a topic that may have been moved "parent" if searching for topics that have a specific parent i.e. its children "field" if searching for topics that have a particular form field value (use the name and value parameters to specify which field to search) | Required |
web="%WEB%" | Wiki web to search: A web, a list of webs separated by whitespace, or all webs. | Current web |
topic="%TOPIC%" | The topic the search relates to, for topicmoved and parent searches | All topics in a web |
name | form field to search, for field type searches. May be a regular expression (see SEARCH). | |
value | form field value, for field type searches. May be a regular expression (see SEARCH). | |
title="Title" | Text that is prefixed to any search results | empty |
format="..." | Custom format results. Supports same format strings as SEARCH. See FormattedSearch for usage, variables & examples | Results in table |
default="none" | Default text shown if no search hit | Empty |
- Example:
%METASEARCH{type="topicmoved" web="%WEB%" topic="%TOPIC%" title="This topic used to exist and was moved to: "}%
- Example: You may want to use this in WebTopicViewTemplate and WebTopicNonWikiTemplate:
%METASEARCH{type="parent" web="%WEB%" topic="%TOPIC%" title="Children: "}%
- Example:
%METASEARCH{type="field" name="Country" value="China"}%
- Related: SEARCH, META
-
Note: METASEARCH is deprecated in favour of the new and much more powerful query type search. See SEARCH and QuerySearch.
N -- "new" icon
- Type: Preference variable - TWikiRenderingShortcut.
- Current value: N =
- Related: H, I, ICON, M, P, Q, S, T, U, X, Y
NAVY -- start navy blue colored text
-
NAVY
is one of the rendering shortcut settings predefined in TWikiPreferences. See the section rendering shortcut settings in that topic for a complete list of colors.
- Syntax:
%NAVY% navy text %ENDCOLOR%
- Expands to: navy text
- Note:
%<color>%
text must end with %ENDCOLOR%
. If you want to switch from one color to another one you first need to end the active color with %ENDCOLOR%
, e.g. write %RED% some text %ENDCOLOR% %GREEN% more text %ENDCOLOR%
.
- Related: ENDCOLOR, TWikiPreferences, StandardColors
NOP -- template text not to be expanded in instantiated topics
- Syntax:
%NOP%
- In normal topic text, expands to <nop>, which prevents expansion of adjacent variables and wikiwords
- When the topic containing this is used as a template for another topic, it is removed.
- Syntax:
%NOP{...}%
deprecated
- In normal topic text, expands to whatever is in the curly braces (if anything).
-
Note: This is deprecated. Do not use it. Use %STARTSECTION{type="templateonly"}%
.. %ENDSECTION{type="templateonly"}%
instead (see TWikiTemplates for more details).
- Related: STARTSECTION, TWikiTemplates
NOTIFYTOPIC -- name of the notify topic
OLIVE -- start olive green colored text
-
OLIVE
is one of the rendering shortcut settings predefined in TWikiPreferences. See the section rendering shortcut settings in that topic for a complete list of colors.
- Syntax:
%OLIVE% olive text %ENDCOLOR%
- Expands to: olive text
- Note:
%<color>%
text must end with %ENDCOLOR%
. If you want to switch from one color to another one you first need to end the active color with %ENDCOLOR%
, e.g. write %RED% some text %ENDCOLOR% %GREEN% more text %ENDCOLOR%
.
- Related: ENDCOLOR, TWikiPreferences, StandardColors
ORANGE -- start orange colored text
-
ORANGE
is one of the rendering shortcut settings predefined in TWikiPreferences. See the section rendering shortcut settings in that topic for a complete list of colors.
- Syntax:
%ORANGE% orange text %ENDCOLOR%
- Expands to: orange text
- Note:
%<color>%
text must end with %ENDCOLOR%
. If you want to switch from one color to another one you first need to end the active color with %ENDCOLOR%
, e.g. write %RED% some text %ENDCOLOR% %GREEN% more text %ENDCOLOR%
.
- Related: ENDCOLOR, TWikiPreferences, StandardColors
P -- pencil icon
- Type: Preference variable - TWikiRenderingShortcut.
- Current value: P =
- Related: H, I, ICON, M, N, Q, S, T, U, X, Y
PINK -- start pink colored text
-
PINK
is one of the rendering shortcut settings predefined in TWikiPreferences. See the section rendering shortcut settings in that topic for a complete list of colors.
- Syntax:
%PINK% pink text %ENDCOLOR%
- Expands to: pink text
- Note:
%<color>%
text must end with %ENDCOLOR%
. If you want to switch from one color to another one you first need to end the active color with %ENDCOLOR%
, e.g. write %RED% some text %ENDCOLOR% %GREEN% more text %ENDCOLOR%
.
- Related: ENDCOLOR, TWikiPreferences, StandardColors
PLUGINDESCRIPTIONS -- list of plugin descriptions
- Syntax:
%PLUGINDESCRIPTIONS%
- Expands to:
- TWikiCompatibilityPlugin (Foswiki-1.0, $Rev: 3132 (2009-03-16) $): add TWiki personality to Foswiki
- SpreadSheetPlugin (06 Jan 2009, $Rev: 3048 (2009-03-12) $): Add spreadsheet calculation like
"$SUM( $ABOVE() )"
to Foswiki tables and other topic text - CommentPlugin (Foswiki-1.0.1, $Rev: 3048 (2009-03-12) $): Quickly post comments to a page without an edit/preview/save cycle
- ActionTrackerPlugin (21 May 2007, $Rev: 2242 (30 Jan 2009) $): Adds support for action tags in topics, and automatic notification of action statuses
- JQueryPlugin (3.51, $Rev: 20090710 (2009-07-10) $): jQuery JavaScript library for Foswiki
- JumpAutocompletePlugin (Foswiki-1.0.0, $Rev: 1 (3 Apr 2009) $): Makes the jump box autocomplete topic names
- AntiWikiSpamPlugin (1.5, 1.5): Lightweight wiki spam prevention
- AttachmentListPlugin (1.3.3, $Rev: 4282 (2009-06-22) $):
- BibliographyPlugin (2.2.2, $Rev: 11925 (2011-06-15) $): Cite bibliography in one topic and get a references list automatically created.
- CalendarPlugin (2.000, $Rev: 8058 (2010-07-07) $): Show a monthly calendar with highlighted events
- CheckToIncludePlugin ($Date: 2008-12-14 18:49:56 +0100 (Sun, 14 Dec 2008) $, $Rev: 3048 (2009-03-12) $): Conditionally Include Topics
- DirectedGraphPlugin (Foswiki-1.0.0, $Rev: 1.2 (19 Mar 2009) $): Embed directed graphs in TWiki topics
- DpSyntaxHighlighterPlugin (1.9, $Rev: 8361 (2010-07-30) $): Client side syntax highlighting using the dp.SyntaxHighlighter
- EFetchPlugin (Foswiki-1.0.0, $Rev: 1 (16 Mar 2009) $): Grab abstract information from PubMed
- EditTablePlugin (4.20, $Rev: 3160 (2009-03-18) $): Edit tables using edit fields, date pickers and drop down boxes
- EmbedBibPlugin (Foswiki-1.0.0, $Rev: 1 (25 Mar 2009) $): Embeds BibTeX entries in a TWiki page
- FoldingTOCPlugin (Pants, $Rev: 1 (2009-04-07) $): Provides a table of contents that folds
- GoogleAnalyticsPlugin (2.1.1, 4729): Adds Google Analytics javascript code to specified pages
- InterwikiPlugin (03 Aug 2008, $Rev: 3048 (2009-03-12) $): Link
ExternalSite:Page
text to external sites based on aliases defined in a rules topic - LatexModePlugin (3.71, $Rev: 16926 (12 Dec 2008) $): Enables LaTeX markup (mathematics and more) in TWiki topics
- LightboxPlugin (Oct 2009, $Rev: 5249 (2009-10-09) $): Foswiki hooks to the Lightbox Javascript package for better thumbnail image click-through
- PreferencesPlugin (Foswiki-1.0, $Rev: 3048 (2009-03-12) $): Allows editing of preferences using fields predefined in a form
- RandomTopicPlugin (20100328, $Rev: 6961 (2010-03-28) $): Pick a selection of Random Topics
- SlideShowPlugin (02 Aug 2008, $Rev: 3048 (2009-03-12) $): Create web based presentations based on topics with headings.
- SmiliesPlugin (04 Jan 2009, $Rev: 3048 (2009-03-12) $): Render smilies as icons, like
for :-)
or
for :eek:
- StylishPlugin (0.0.1, $Rev: 3048 (2009-03-12) $): Plugin for registering stylesheets and what not
- TablePlugin (1.037, $Rev: 3048 (2009-03-12) $): Control attributes of tables and sorting of table columns
- TagCloudPlugin (v2.21, $Rev: 5764 (2009-12-10) $): Renders a tag cloud given a list of terms
- TagMePlugin (02 Mar 2010, $Rev: 6613 (2010-03-02) $): Tag wiki content collectively to find content by keywords
- TinyMCEPlugin (21 Jan 2009, $Rev: 3048 (2009-03-12) $): Integration of TinyMCE? with WysiwygPlugin
- TopicDataHelperPlugin (1.1.1, $Rev: 4253 (2009-06-20) $):
- TopicVarsPlugin (Foswiki-1.0.0, 1.000): allows you to define variables
- TopicVotePlugin (v1.3.1, $Rev: 3048 (2010-01-29) $): Enables voting on topics
- TreePlugin (1.9.1, $Rev: 6156 (2010-01-27) $): Renders topics' parent-child relationships as hierarchical tree view. Useful for dynamic site maps and threads.
- TwistyPlugin (1.5.4, $Rev: 6281 (2010-02-12) $): Twisty section Javascript library to open/close content dynamically
- VotePlugin (1.33, $Rev: 5560 (2009-11-17) $): Simple way to count votes
- WysiwygPlugin (03 Aug 2008, $Rev: 3048 (2009-03-12) $): Translator framework for Wysiwyg editors
- ZonePlugin (2.1, $Rev: 6966 (2010-03-28) $): Gather content of a page in named zones while rendering it
- Related: ACTIVATEDPLUGINS, FAILEDPLUGINS, PLUGINVERSION
PLUGINVERSION -- the version of a TWiki Plugin, or the TWiki Plugins API
- Syntax:
%PLUGINVERSION{"name"}%
to get the version of a specific plugin
- Example:
%PLUGINVERSION{"InterwikiPlugin"}%
expands to $Rev: 3048 (2009-03-12) $
- Syntax:
%PLUGINVERSION%
to get the version of the API
- Expands to:
2.0
- Related: WIKIVERSION, ACTIVATEDPLUGINS, FAILEDPLUGINS, PLUGINDESCRIPTIONS
PUBURL -- the base URL of attachments
PUBURLPATH -- the base URL path of attachments
PURPLE -- start purple colored text
-
PURPLE
is one of the rendering shortcut settings predefined in TWikiPreferences. See the section rendering shortcut settings in that topic for a complete list of colors.
- Syntax:
%PURPLE% purple text %ENDCOLOR%
- Expands to: purple text
- Note:
%<color>%
text must end with %ENDCOLOR%
. If you want to switch from one color to another one you first need to end the active color with %ENDCOLOR%
, e.g. write %RED% some text %ENDCOLOR% %GREEN% more text %ENDCOLOR%
.
- Related: ENDCOLOR, TWikiPreferences, StandardColors
Q -- question icon
- Type: Preference variable - TWikiRenderingShortcut.
- Current value: Q =
- Related: H, I, ICON, M, N, P, S, T, U, X, Y
QUERYPARAMS -- show paramaters to the query
- Expands the parameters to the query that was used to display the page.
- Syntax:
%QUERYPARAMS{...}%
- Parameters:
-
format="..."
format string for each entry, default $name=$value
-
separator="..."
separator string, default separator="$n"
(newline)
-
encoding="..."
the encoding to apply to parameter values; see ENCODE for a description of the available encodings. If this parameter is not given, no encoding is performed.
- The following escape sequences are expanded in the format string:
Sequence: |
Expands To: |
$name |
Name of the parameter |
$value |
String value of the parameter. Multi-valued parameters will have a "row" for each value. |
$n or $n() |
New line. Use $n() if followed by alphanumeric character, e.g. write Foo$n()Bar instead of Foo$nBar |
$nop or $nop() |
Is a "no operation". This variable gets removed; useful for nested search |
$quot |
Double quote (" ) (\" also works) |
$percnt |
Percent sign (% ) |
$dollar |
Dollar sign ($ ) |
- Example:
-
%QUERYPARAMS{format="<input type='hidden' name='$name' value='$value' encoding="entity" />"}%
- See also QUERYSTRING, URLPARAM
QUERYSTRING -- full, unprocessed string of parameters to this URL
- String of all the URL parameters that were on the URL used to get to the current page. For example, if you add ?name=Samantha;age=24;eyes=blue to this URL you can see this in action. This string can be appended to a URL to pass parameter values on to another page.
-
Note: URLs built this way are typically restricted in length, typically to 2048 characters. If you need more space than this, you will need to use an HTML form and %QUERYPARAMS%
.
- Syntax:
%QUERYSTRING%
- Expands to:
- Related: QUERYPARAMS, URLPARAM
RED -- start red colored text
-
RED
is one of the rendering shortcut settings predefined in TWikiPreferences. See the section rendering shortcut settings in that topic for a complete list of colors.
- Syntax:
%RED% red text %ENDCOLOR%
- Expands to: red text
- Note:
%<color>%
text must end with %ENDCOLOR%
. If you want to switch from one color to another one you first need to end the active color with %ENDCOLOR%
, e.g. write %RED% some text %ENDCOLOR% %GREEN% more text %ENDCOLOR%
.
- Related: ENDCOLOR, TWikiPreferences, StandardColors
REMOTE_ADDR -- environment variable
REMOTE_PORT -- environment variable
REMOTE_USER -- environment variable
RENDERLIST -- render bullet lists in a variety of formats
- The
%RENDERLIST%
variable is handled by the RenderListPlugin
- Syntax:
%RENDERLIST%
- Syntax:
%RENDERLIST{ "org" focus="Sales.WestCoastTeam" }%
- Example:
%RENDERLIST{ "org" }%
* [[Eng.WebHome][Engineering]]
* [[Eng.TechPubs][Tech Pubs]]
* [[Sales.WestCoastTeam][Sales]]
* [[Sales.EastCoastTeam][East Coast]]
* [[Sales.WestCoastTeam][West Coast]]
- Related: RenderListPlugin
REVINFO -- revision information of current topic
REVINFO{"format"} -- formatted revision information of topic
- Syntax:
%REVINFO{"format"}%
- Supported parameters:
Parameter: | Description: | Default: |
"format" | Format of revision information, see supported variables below | "r1.$rev - $date - $wikiusername" |
web="..." | Name of web | Current web |
topic="..." | Topic name | Current topic |
rev="1.5" | Specific revison number | Latest revision |
- Supported variables in format:
Variable: | Unit: | Example |
$web | Name of web | Current web |
$topic | Topic name | Current topic |
$rev | Revison number. Prefix r1. to get the usual r1.5 format | 5 |
$username | Login username of revision | jsmith |
$wikiname | WikiName of revision | JohnSmith |
$wikiusername | WikiName with Main web prefix | Main.JohnSmith |
$date | Revision date. Actual date format defined as {DefaultDateFormat} in configure | 21 Sep 2006 |
$time | Revision time | 23:24:25 |
$iso | Revision date in ISO date format | 2006-09-22T06:24:25Z |
$min , $sec , etc. | Same date format qualifiers as GMTIME{"format"} | |
- Example:
%REVINFO{"$date - $wikiusername" rev="1.1"}%
returns revision info of first revision
- Related: GMTIME{"format"}, REVINFO
S -- red star icon
- Type: Preference variable - TWikiRenderingShortcut.
- Current value: S =
- Related: H, I, ICON, M, N, P, Q, T, U, X, Y
SCRIPTNAME -- name of current script
- The name of the current script is shown, including script suffix, if any (for example
viewauth.cgi
)
- Syntax:
%SCRIPTNAME%
- Expands to:
view
- Related: SCRIPTSUFFIX, SCRIPTURL, SCRIPTURLPATH
SCRIPTSUFFIX -- script suffix
- Some CTSPedia installations require a file extension for CGI scripts, such as
.pl
or .cgi
- Syntax:
%SCRIPTSUFFIX%
- Expands to:
- Related: SCRIPTNAME, SCRIPTURL, SCRIPTURLPATH
SCRIPTURL -- base URL of TWiki scripts
SCRIPTURL{"script"} -- URL of TWiki script
- Syntax:
%SCRIPTURL{"script"}%
- Expands to:
https://www.ctspedia.org/do/script
- Example: To get the authenticated version of the current topic you can write
%SCRIPTURL{"viewauth"}%/%WEB%/%TOPIC%
which expands to https://www.ctspedia.org/do/viewauth/TWiki/TWikiVariables
-
Note: In most cases you should use %SCRIPTURLPATH{"script"}%
instead, as it works with URL rewriting much better
- Related: PUBURL, SCRIPTNAME, SCRIPTSUFFIX, SCRIPTURL, SCRIPTURLPATH, SCRIPTURLPATH{"script"}
SCRIPTURLPATH -- base URL path of TWiki scripts
- As
%SCRIPTURL%
, but doesn't include the protocol and host part of the URL
- Syntax:
%SCRIPTURLPATH%
- Expands to:
/do
- Note: The
edit
script should always be used in conjunction with ?t=%GMTIME{"$epoch"}%
to ensure pages about to be edited are not cached in the browser
- Related: PUBURLPATH, SCRIPTNAME, SCRIPTSUFFIX, SCRIPTURL, SCRIPTURLPATH{"script"}
SCRIPTURLPATH{"script"} -- URL path of TWiki script
SEARCH{"text"} -- search content
- Inline search, shows a search result embedded in a topic
- Syntax:
%SEARCH{"text" ...}%
- Supported parameters:
Parameter: | Description: | Default: |
"text" | Search term. Is a keyword search, literal search, regular expression search, or query, depending on the type parameter. SearchHelp has more | required |
search="text" | (Alternative to above) | N/A |
web="Name" web="Main, Know" web="all" | Comma-separated list of webs to search. You can specifically exclude webs from an all search using a minus sign - for example, web="all,-Secretweb" . The special word all means all webs that do not have the NOSEARCHALL variable set to on in their WebPreferences. Note that TWikiAccessControls are respected when searching webs; it is much better to use them than NOSEARCHALL . | Current web |
topic="WebPreferences" topic="*Bug" | Limit search to topics: A topic, a topic with asterisk wildcards, or a list of topics separated by comma. Note this is a list of topic names and must not include web names. | All topics in a web |
excludetopic="Web*" excludetopic="WebHome, WebChanges" | Exclude topics from search: A topic, a topic with asterisk wildcards, or a list of topics separated by comma. Note this is a list of topic names and must not include web names. | None |
scope="topic" scope="text" scope="all" | Search topic name (title); the text (body) of topic; or all (title and body) | "text" |
type="keyword" type="word" type="literal" type="regex" type="query" | Control how the search is performed when scope="text" or scope="all" keyword : use Google-like controls as in soap "web service" -shampoo ; searches word parts: using the example, topics with "soapsuds" will be found as well, but topics with "shampoos" will be excluded word : identical to keyword but searches whole words: topics with "soapsuds" will not be found, and topics with "shampoos" will not be excluded literal : search for the exact string, like web service regex : use a RegularExpression search like soap;web service;!shampoo ; to search on whole words use \bsoap\b query : query search of form fields and other meta-data, like (Firstname='Emma' OR Firstname='John') AND Lastname='Peel' | %SEARCHVAR- DEFAULTTYPE% preferences setting (literal) |
order="topic" order="created" order="modified" order="editby" order= "formfield(name)" | Sort the results of search by the topic names, topic creation time, last modified time, last editor, or named field of TWikiForms. The sorting is done web by web; if you want to sort across webs, create a formatted table and sort it with TablePlugin's initsort. Note that dates are sorted most recent date last (i.e at the bottom of the table). | Sort by topic name |
limit="all" limit="16" | Limit the number of results returned. This is done after sorting if order is specified | All results |
date="..." | limits the results to those pages with latest edit time in the given time interval. | All results |
reverse="on" | Reverse the direction of the search | Ascending search |
casesensitive="on" | Case sensitive search | Ignore case |
bookview="on" | BookView search, e.g. show complete topic text | Show topic summary |
nonoise="on" | Shorthand for nosummary="on" nosearch="on" nototal="on" zeroresults="off" noheader="on" noempty="on" | Off |
nosummary="on" | Show topic title only | Show topic summary |
nosearch="on" | Suppress search string | Show search string |
noheader="on" | Suppress default search header Topics: Changed: By: , unless a header is explicitly specified | Show default search header, unless search is inline and a format is specified (Cairo compatibility) |
nototal="on" | Do not show number of topics found | Show number |
zeroresults="off" | Suppress all output if there are no hits | zeroresults="on" , displays: "Number of topics: 0" |
noempty="on" | Suppress results for webs that have no hits. | Show webs with no hits |
header="..." format="..." | Custom format results: see FormattedSearch for usage, variables & examples | Results in table |
expandvariables="on" | Expand variables before applying a FormattedSearch on a search hit. Useful to show the expanded text, e.g. to show the result of a SpreadSheetPlugin %CALC{}% instead of the formula | Raw text |
multiple="on" | Multiple hits per topic. Each hit can be formatted. The last token is used in case of a regular expression ";" and search | Only one hit per topic |
nofinalnewline="on" | If on , the search variable does not end in a line by itself. Any text continuing immediately after the search variable on the same line will be rendered as part of the table generated by the search, if appropriate. | off |
recurse="on" | Recurse into subwebs, if subwebs are enabled. | off |
separator=", " | Line separator between search hits | "$n" (Newline) |
newline="%BR%" | Line separator within a search hit. Useful if the format="" parameter contains a $pattern() that captures more than one line, i.e. contents of a textfield in a form. | "$n" (Newline) |
- Example:
%SEARCH{"wiki" web="Main" scope="topic"}%
- Example with format:
%SEARCH{"FAQ" scope="topic" nosearch="on" nototal="on" header="| *Topic: * | *Summary: * |" format="| $topic | $summary |"}%
(displays results in a table with header - details)
-
Hint: If the TWiki:Plugins.TablePlugin is installed, you may set a %TABLE{}%
variable just before the %SEARCH{}%
to alter the output of a search. Example: %TABLE{ tablewidth="90%" }%
- Related: METASEARCH, TOPICLIST, WEBLIST, FormattedSearch, QuerySearch, SearchHelp, SearchPatternCookbook, RegularExpression
SERVERTIME -- server time
SERVERTIME{"format"} -- formatted server time
- Same format qualifiers as
%GMTIME%
- Syntax:
%SERVERTIME{"format"}%
- Example:
%SERVERTIME{"$hou:$min"}%
expands to 23:27
-
Note: When used in a template topic, this variable will be expanded when the template is used to create a new topic. See TWikiTemplates#TemplateTopicsVars for details.
- Related: DISPLAYTIME, GMTIME, SERVERTIME
SESSIONID -- unique ID for this session
SESSIONVAR -- name of CGI and session variable that stores the session ID
SESSION_VARIABLE -- get, set or clear a session variable
SILVER -- start silver colored text
-
SILVER
is one of the rendering shortcut settings predefined in TWikiPreferences. See the section rendering shortcut settings in that topic for a complete list of colors.
- Syntax:
%SILVER% silver text %ENDCOLOR%
- Expands to: silver text
- Note:
%<color>%
text must end with %ENDCOLOR%
. If you want to switch from one color to another one you first need to end the active color with %ENDCOLOR%
, e.g. write %RED% some text %ENDCOLOR% %GREEN% more text %ENDCOLOR%
.
- Related: ENDCOLOR, TWikiPreferences, StandardColors
SLIDESHOWEND -- end slideshow
SLIDESHOWSTART -- convert a topic with headings into a slideshow
- The
%SLIDESHOWSTART%
variable is handled by the SlideShowPlugin
- Syntax:
%SLIDESHOWSTART%
- Syntax:
%SLIDESHOWSTART{ template="MyOwnSlideTemplate" }%
- Example:
%SLIDESHOWSTART%
---++ Sample Slide 1
* Bullet 1
* Bullet 2
---++ Sample Slide 2
* Bullet 1
* Bullet 2
%SLIDESHOWEND%
- Related: SLIDESHOWEND, SlideShowPlugin
SPACEDTOPIC -- topic name, spaced and URL-encoded deprecated
- The current topic name with added URL-encoded spaces, for use in regular expressions that search for backlinks to the current topic
- Syntax:
%SPACEDTOPIC%
- Expands to:
Var%20*SPACEDTOPIC
-
Note: This is a deprecated variable. It can be duplicated with %ENCODE{%SPACEOUT{"%TOPIC%" separator=" *"}%}%
- Related: SPACEOUT, TOPIC, ENCODE
SPACEOUT{"string"} -- renders string with spaces inserted in sensible places
- Inserts spaces after lower case letters that are followed by a digit or a capital letter, and after digits that are followed by a capital letter.
- Useful for spacing out WikiWords
- Syntax:
%SPACEOUT{ "%TOPIC%" }%
- Expands to:
TWiki Variables
- Supported parameters:
Parameter: | Description: | Default: |
separator | The separator to put between words e.g. %SPACEOUT{"DogsCatsBudgies" separator=", "}% -> Dogs, Cats, Budgies | ' ' |
-
Hint: Spaced out WikiWords are not automatically linked. To SPACEOUT a WikiWord but preserve the link use "double bracket" format. For example, [[WebHome][%SPACEOUT{"WebHome"}%]]
expands to Web Home
- Related: SPACEDTOPIC, $PROPERSPACE() of SpreadSheetPlugin
STARTINCLUDE -- start position of topic text if included
- 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 everything exept the %STARTINCLUDE%
variable itself.
- Note: If you want more than one part of the topic included, use
%STARTSECTION{type="include"}%
instead
- Syntax:
%STARTINCLUDE%
- Related: INCLUDE, STARTSECTION, STOPINCLUDE
STARTSECTION -- marks the start of a section within a topic
- Section boundaries are defined with
%STARTSECTION{}%
and %ENDSECTION{}%
.
- Sections may be given a name to help identify them, and/or a type, which changes how they are used.
-
type="section"
- the default, used for a generic section, such as a named section used by INCLUDE.
-
type="include"
- like %STARTINCLUDE%
... %STOPINCLUDE%
except that you can have as many include blocks as you want (%STARTINCLUDE%
is restricted to only one).
-
type="templateonly"
- start position of text to be removed when a template topic is used. This is used to embed text that you do not want expanded when a new topic based on the template topic is created. See TWikiTemplates for more information.
- Syntax:
%STARTSECTION{"name"}% ................ %ENDSECTION{"name"}%
- Syntax:
%STARTSECTION{type="include"}% ........ %ENDSECTION{type="include"}%
- Syntax:
%STARTSECTION{type="templateonly"}% ... %ENDSECTION{type="templateonly"}%
- Supported parameters:
Parameter: | Description: | Default |
"name" | Name of the section. Must be unique inside a topic. | Generated name |
type="..." | Type of the section; type "section" , "include" or "templateonly" | "section" |
-
Note: If a section is not given a name, it will be assigned one. Unnamed sections are assigned names starting with _SECTION0
for the first unnamed section in the topic, _SECTION1
for the second, etc..
-
Note: You can define nested sections. It is not recommended to overlap sections, although it is valid in TWiki. Use named sections to make sure that the correct START and ENDs are matched. Section markers are not displayed when a topic is viewed.
- Related: ENDSECTION, INCLUDE, NOP, STARTINCLUDE, STOPINCLUDE
STATISTICSTOPIC -- name of statistics topic
STOPINCLUDE -- end position of topic text if included
- 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.
- Syntax:
%STOPINCLUDE%
- Related: INCLUDE, STARTINCLUDE
SYSTEMWEB -- name of TWiki documentation web
- The web containing all documentation and default preference settings
- Syntax:
%SYSTEMWEB%
- Expands to:
System
- Related: USERSWEB
T -- tip icon
- Type: Preference variable - TWikiRenderingShortcut.
- Current value: T =
- Related: H, I, ICON, M, N, P, Q, S, U, X, Y
TABLE{ attributes } -- control attributes of tables and sorting of table columns
- The
%TABLE{}%
variable is handled by the TablePlugin
- Syntax:
%TABLE{ attributes }%
- Supported attributes:
Argument | Comment | Default value | Example |
sort | Set table sorting by clicking headers "on" or "off" . | unspecified | sort="on" |
initsort | Column to sort initially ("1" to number of columns). | unspecified | initsort="2" |
initdirection | Initial sorting direction for initsort , set to "up" (descending) or "down" (ascending). | unspecified | initdirection="up" |
disableallsort | Disable all sorting, both initsort and header sort. This is mainly used by plugins such as the EditTablePlugin to disable sorting in a table while editing the table. | unspecified | disableallsort="on" |
headerbg | Header cell background colour. | "#6b7f93" | headerbg="#999999" |
headerbgsorted | Header cell background colour of a sorted column. | the value of headerbg | headerbgsorted="#32596c" |
headercolor | Header cell text colour. | "#ffffff" | headercolor="#0000cc" |
databg | Data cell background colour, a comma separated list. Specify "none" for no colour, that is to use the colour/background of the page the table is on. | "#edf4f9,#ffffff" | databg="#f2f2f2,#ffffff" |
databgsorted | Data cell background colour of a sorted column; see databg . | the values of databg | databgsorted="#d4e8e4,#e5f5ea" |
datacolor | Data cell text colour, a comma separated list. | unspecified | datacolor="#0000CC, #000000" |
tableborder | Table border width (pixels). | "1" | tableborder="2" |
tableframe | Table frame, set to "void" (no sides), "above" (the top side only), "below" (the bottom side only), "hsides" (the top and bottom sides only), "lhs" (the left-hand side only), "rhs" (the right-hand side only), "vsides" (the right and left sides only), "box" (all four sides), "border" (all four sides). | unspecified | tableframe="hsides" |
tablerules | Table rules, set to "none" (no rules), "groups" (rules will appear between row groups and column groups only), "rows" (rules will appear between rows only), "cols" (rules will appear between columns only), "all" (rules will appear between all rows and columns). | unspecified | tablerules="rows" |
cellpadding | Cell padding (pixels). | "0" | cellpadding="0" |
cellspacing | Cell spacing (pixels). | "0" | cellspacing="3" |
cellborder | Cell border width (pixels). | unspecified | cellborder="0" |
valign | Vertical alignment of cells and headers, set to "top" , "middle" , "bottom" or "baseline" . | unspecified | valign="top" |
headervalign | Vertical alignment of header cells; overrides valign . | unspecified | headervalign="top" |
datavalign | Vertical alignment of data cells; overrides valign . | unspecified | datavalign="top" |
headeralign | Header cell alignment, one value for all columns, or a comma separated list for different alignment of individual columns. Set to "left" , "center" , "right" or "justify" . Overrides individual cell settings. | unspecified | headeralign="left,right" |
dataalign | Data cell alignment, one value for all columns, or a comma separated list for different alignment of individual columns. Set to "left" , "center" , "right" or "justify" . Overrides individual cell settings. | unspecified | dataalign="center" |
tablewidth | Table width: Percentage of window width, or absolute pixel value. | unspecified | tablewidth="100%" |
columnwidths | Column widths: Comma delimited list of column widths, percentage or absolute pixel value. | unspecified | columnwidths="80%,20%" |
headerrows | Number of header rows to exclude from sort. (will be rendered in a HTML thead section) | "1" | headerrows="1" |
footerrows | Number of footer rows to exclude from sort. (will be rendered in a HTML tfoot section) | "0" | footerrows="1" |
id | Unique table identifier string, used for targeting a table with CSS. | tableN (where N is the table order number on the page) | id="userTable" |
summary | Table summary used by screenreaders: A summary of what the table presents. It should provide an orientation for someone who listens to the table. | unspecified | summary="List of subscribed users" |
caption | Table caption: A title that will be displayed just above the table. | unspecified | caption="Users" |
- Example:
%TABLE{ tableborder="0" cellpadding="4" cellspacing="3" cellborder="0" }%
| *A1* | *B1* |
| A2 | B2 |
- Related: See TablePlugin for more details
TEAL -- start teal colored text
-
TEAL
is one of the rendering shortcut settings predefined in TWikiPreferences. See the section rendering shortcut settings in that topic for a complete list of colors.
- Syntax:
%TEAL% teal text %ENDCOLOR%
- Expands to: teal text
- Note:
%<color>%
text must end with %ENDCOLOR%
. If you want to switch from one color to another one you first need to end the active color with %ENDCOLOR%
, e.g. write %RED% some text %ENDCOLOR% %GREEN% more text %ENDCOLOR%
.
- Related: ENDCOLOR, TWikiPreferences, StandardColors
TOC -- table of contents of current topic
TOC{"Topic"} -- table of contents
- 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. Any heading text after "!!"
is excluded from the TOC; for example, write "---+!! text"
if you do not want to list a header in the TOC
- Syntax:
%TOC{"SomeTopic" ...}%
- Supported parameters:
Parameter: | Description: | Default: |
"TopicName" | topic name | Current topic |
web="Name" | Name of web | Current web |
depth="2" | Limit depth of headings shown in TOC | 6 |
title="Some text" | Title to appear at top of TOC | none |
- Example:
%TOC{depth="2"}%
- Example:
%TOC{"TWikiDocumentation" web="System" title="Contents:"}%
- Example: see TWiki:Sandbox.TestTopicInclude
-
Hint: TOC will generate links to the headings, so when a reader clicks on a heading it will jump straight where that heading is anchored in the text. If you have two headings with exactly the same text, then their anchors will also be identical and they won't be able to jump to them. To make the anchors unique, you can add an invisible HTML comment to the text of the heading. This will be hidden in normal view, but will force the anchors to be different. For example, ---+ Heading <!--5-->.
- Related: TOC
TOPIC -- name of current topic
-
%TOPIC%
expands to the name of the topic. If you are looking at the text of an included topic, it is the name of the included topic.
- Syntax:
%TOPIC%
- Expands to:
TWikiVariables
, renders as TWikiVariables
- Related: BASETOPIC, INCLUDINGTOPIC, TOPICLIST, WEB
TOPICLIST{"format"} -- topic index of a web
- List of all topics in a web. The "format" defines the format of one topic item. It may include variables: The
$topic
variable gets expanded to the topic name, $marker
to marker
parameter where topic matches selection
, and $web
to the name of the web, or any of the standard FormatTokens.
- Syntax:
%TOPICLIST{"format" ...}%
- Supported parameters:
Parameter: | Description: | Default: |
"format" | Format of one line, may include $web (name of web), $topic (name of the topic), $marker (which expands to marker for the item matching selection only) | "$topic" |
format="format" | (Alternative to above) | "$topic" |
separator=", " | line separator | "$n" (new line) |
marker="selected" | Text for $marker if the item matches selection | "selected" |
selection="TopicA, TopicB" | Current value to be selected in list | (none) |
web="Name" | Name of web | Current web |
- Example:
%TOPICLIST{" * $web.$topic"}%
creates a bullet list of all topics
- Example:
%TOPICLIST{separator=", "}%
creates a comma separated list of all topics
- Example:
%TOPICLIST{" <option>$topic</option>"}%
creates an option list (for drop down menus)
- Example:
<select>%TOPICLIST{" <option $marker value='$topic'>$topic</option>" separator=" " selection="%TOPIC%"}%</select>
creates an option list of web topics with the current topic selected
- Related: SEARCH, WEBLIST
TOPICURL -- shortcut to viewing the current topic
TWIKIWEB -- synonym for SYSTEMWEB
- Deprecated. Please use
%SYSTEMWEB%
instead.
U -- "updated" icon
- Type: Preference variable - TWikiRenderingShortcut.
- Current value: U =
- Related: H, I, ICON, M, N, P, Q, S, T, X, Y
URLPARAM{"name"} -- get value of a URL parameter
- Returns the value of a URL parameter.
- Syntax:
%URLPARAM{"name"}%
- Supported parameters:
Parameter: | Description: | Default: |
"name" | The name of a URL parameter | required |
default="..." | Default value in case parameter is empty or missing | empty string |
newline="<br />" | Convert newlines in textarea to other delimiters | no conversion |
encode="entity" | Encode special characters into HTML entities. See ENCODE for more details. | no encoding |
encode="url" | Encode special characters for URL parameter use, like a double quote into %22 | no encoding |
encode="quote" | Escape double quotes with backslashes (\" ), does not change other characters; required when feeding URL parameters into other TWiki variables | no encoding |
multiple="on" multiple="[[$item]]" | If set, gets all selected elements of a <select multiple="multiple"> tag. A format can be specified, with $item indicating the element, e.g. multiple="Option: $item" | first element |
separator=", " | Separator between multiple selections. Only relevant if multiple is specified | "\n" (new line) |
- Example:
%URLPARAM{"skin"}%
returns print
for a .../view/TWiki/TWikiVariables?skin=print
URL
-
Notes:
- URL parameters passed into HTML form fields must be entity ENCODEd.
- Double quotes in URL parameters must be escaped when passed into other TWiki variables.
Example: %SEARCH{ "%URLPARAM{ "search" encode="quotes" }%" noheader="on" }%
- When used in a template topic, this variable will be expanded when the template is used to create a new topic. See TWikiTemplates#TemplateTopicsVars for details.
- Watch out for TWiki internal parameters, such as
rev
, skin
, template
, topic
, web
; they have a special meaning in TWiki. Common parameters and view script specific parameters are documented at TWikiScripts.
- If you have
%URLPARAM{
in the value of a URL parameter, it will be modified to %<nop>URLPARAM{
. This is to prevent an infinite loop during expansion.
- There is a risk that this variable could be misused for cross-site scripting.
- Related: ENCODE, SEARCH, FormattedSearch, QUERYSTRING
USERINFO{"name"} -- retrieve details about a user
- Syntax:
%USERINFO%
- Expands to:
guest, WikiGuest?,
(comma-separated list of the username, wikiusername, and emails)
- With formatted output, using tokens
$emails
, $username
, $wikiname
, $wikiusername
, $groups
and $admin
($admin returns 'true' or 'false'):
- Example:
%USERINFO{ format="$username is really $wikiname" }%
- Expands to:
guest is really WikiGuest
- Retrieve information about another user:
- Example:
%USERINFO{ "TWikiGuest" format="$username is really $wikiname" }%
- Expands to:
- Note: The parameter should be the wikiname of a user. Since TWiki 4.2.1, you can also pass a login name. You can only get information about another user if the
{AntiSpam}{HideUserDetails}
configuration option is not enabled, or if you are an admin. (User details are hidden in this TWiki)
- Related: USERNAME, WIKINAME, WIKIUSERNAME, TWikiUserAuthentication, ChangeEmailAddress
USERNAME -- your login username
USERSWEB -- name of users web
- The web containing individual user topics, TWikiGroups, and customised site-wide preferences.
- Syntax:
%USERSWEB%
- Expands to:
Main
- Related: SYSTEMWEB
VAR{"NAME" web="Web"} -- get a preference value from another web
- Syntax:
%VAR{"NAME" web="Web"}%
- Example: To get
%WEBBGCOLOR%
of the Main web write %VAR{"WEBBGCOLOR" web="Main"}%
, which expands to #a0bad4
- Related: WEBPREFSTOPIC
VBAR -- vertical bar
VOTE{ attributes } -- define a poll in a TWiki topic.
- The following standard attributes are recognized
Name | Description | Example |
id | The identifier of the poll. You can have multiple independent votes in the same topic. | id="Dining" |
selectN | Defines the name of a select vote, where you select one from a ranges of options. N is a number that identifies this item within the poll e.g. select1 , select2 etc. You must number all select and stars parameters uniquely and sequentially (e.g. select1 stars2 select3 | select1="Drink" |
optionsN | Each selectN must have a corresponding optionsN that defines a comma-separated list of the options that can be selected between. | options1="Beer,Wine,Milk" |
starsN | Defines the name of a rate vote, where you rate something by giving it a number of stars. N is a number that identifies this item within the poll e.g. select1 , stars2 etc. You must number all select and stars parameters uniquely and sequentially (e.g. select1 stars2 select3 | stars2="Usability" |
widthN | Each starsN must have a corresponding widthN . This gives the number of stars to show e.g. width1="5" will show 5 stars. | width2="10" |
formatN | Defines the format of the results display. See formatting results, below. | format="$large" |
chartN | Defines the format of a single bar in the results bar chart generated for the corresponding select (for select type only). See formatting results, below. | chart="<p>$option $score</p>" |
separator | Defines the string to be used to separate each row in the result. | separator="<br/>" |
global | If set to "off" , this makes the id local to this topic (the default). If set to "on" it will be a global poll that can be accessed from many topics. | global="on" |
open | If set to "off" this is a closed vote. If set to "on" it is open (the default) | open="on" |
secret | If set to "off" , then the database will record who voted. If set to "on" , votes are secret (the default) | secret="on" |
saveto | If set to the name of a topic, the poll results will be appended to the end of that topic. The results are formatted as a TWiki table for easy post-processing. | saveto="Main.VoteResults" |
bayesian | If set to "on" , rating averages will be computed using the Bayesian average of this item against all the other items that have the same item in their stars field. This requires all the participating %VOTEs to be global , or to save their results to the same place using saveto . See http://www.thebroth.com/blog/118/bayesian-rating for more information about Bayesian rating. | bayesian="off" |
submit | If set to "off" , this makes the %VOTE display the results of the vote without prompting for any input. This is useful when - for example - you want to show the results of a global vote, without permitting more voting. |
WEB -- name of current web
-
%WEB%
expands to the name of the web where the topic is located. If you are looking at the text of an included topic, it is the web where the included topic is located.
- Syntax:
%WEB%
- Expands to:
TWiki
- Related: BASEWEB, INCLUDINGWEB, TOPIC
WEBLIST{"format"} -- index of all webs
- List of all webs. Obfusticated 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
.
- Syntax:
%WEBLIST{"format" ...}%
- Supported parameters:
Parameter: | Description: | Default: |
"format" | Format of one line, may include $name (the name of the web), $qname (the name of the web in double quotes), $indentedname (the name of the web with parent web names replaced by indents, for use in indented lists), and $marker (which expands to marker for the item matching selection only) | "$name" |
format="format" | (Alternative to above) | "$name" |
separator=", " | Line separator | "$n" (new line) |
web="" | if you specify $web in format, it will be replaced with this | "" |
webs="public" | Comma separated list of webs, public expands to all non-hidden. NOTE: Administrators will see all webs, not just the public ones | "public" |
marker="selected" | Text for $marker if the item matches selection | "selected" |
selection="%WEB%" | Current value to be selected in list | selection="%WEB%" |
subwebs="Sandbox" | show webs that are a sub-web of this one (recursivly) | "" |
- Example:
%WEBLIST{" * [[$name.WebHome]]"}%
- creates a bullet list of all webs.
- Example:
<form><select name="web"> %WEBLIST{"<option $marker value=$qname>$name</option>" webs="Trash, public" selection="%WEB%" separator=" "}% </select></form>
- creates a dropdown of all public webs + Trash web, with the current web highlighted.
- Related: TOPICLIST, SEARCH
WEBPREFSTOPIC -- name of web preferences topic
WHITE -- start white colored text
-
WHITE
is one of the rendering shortcut settings predefined in TWikiPreferences. See the section rendering shortcut settings in that topic for a complete list of colors.
- Syntax:
%WHITE% white text %ENDCOLOR%
- Expands to: white text (shown with a gray background here)
- Note:
%<color>%
text must end with %ENDCOLOR%
. If you want to switch from one color to another one you first need to end the active color with %ENDCOLOR%
, e.g. write %RED% some text %ENDCOLOR% %GREEN% more text %ENDCOLOR%
.
- Related: ENDCOLOR, TWikiPreferences, StandardColors
WIKIHOMEURL -- site home URL
- Syntax
%WIKIHOMEURL%
- Expands to
/do/view
- Defined in TWikiPreferences and normally per default set to
%SCRIPTURLPATH{"view"}%
-
Note: For the top bar logo URL use %WIKILOGOURL%
defined in WebPreferences instead.
- Related: WIKITOOLNAME
WIKINAME -- your Wiki username
WIKIPREFSTOPIC -- name of site-wide preferences topic
WIKITOOLNAME -- name of your TWiki site
WIKIUSERNAME -- your Wiki username with web prefix
- Your %WIKINAME% with Main web prefix, useful to point to your CTSPedia home page
- Syntax:
%WIKIUSERNAME%
- Expands to:
Main.WikiGuest
, renders as WikiGuest?
-
Note: When used in a template topic, this variable will be expanded when the template is used to create a new topic. See TWikiTemplates#TemplateTopicsVars for details
- Related: REMOTE_USER, USERINFO, USERNAME, WIKINAME
WIKIUSERSTOPIC -- name of topic listing all registers users
- Syntax:
%WIKIUSERSTOPIC%
- Expands to:
WikiUsers
, with Main prefix renders as WikiUsers
- Related: WIKIUSERNAME
WIKIVERSION -- the version of the installed TWiki engine
X -- warning icon
- Type: Preference variable - TWikiRenderingShortcut.
- Current value: X =
- Related: H, I, ICON, M, N, P, Q, S, T, U, Y
Y -- "yes" icon
- Type: Preference variable - TWikiRenderingShortcut.
- Current value: Y =
- Related: H, I, ICON, M, N, P, Q, S, T, U, X
YELLOW -- start yellow colored text
-
YELLOW
is one of the rendering shortcut settings predefined in TWikiPreferences. See the section rendering shortcut settings in that topic for a complete list of colors.
- Syntax:
%YELLOW% yellow text %ENDCOLOR%
- Expands to: yellow text
- Note:
%<color>%
text must end with %ENDCOLOR%
. If you want to switch from one color to another one you first need to end the active color with %ENDCOLOR%
, e.g. write %RED% some text %ENDCOLOR% %GREEN% more text %ENDCOLOR%
.
- Related: ENDCOLOR, TWikiPreferences, StandardColors
Back to top
TWiki Formatted Search
Inline search feature allows flexible formatting of search result
The default output format of a
%SEARCH{...}%
is a table consisting of topic names and topic summaries. Use the
format="..."
parameter to customize the search result. The format parameter typically defines a bullet or a table row containing variables, such as
%SEARCH{ "food" format="| $topic | $summary |" }%
. See
%SEARCH{...}%
for other search parameters, such as
separator=""
.
- TWiki System Requirements
- TWiki Installation Guide
- TWiki Upgrade Guide
- Wiki User Authentication
- Wiki Access Control
- Raw Edit Formatting or Wiki Text Formatting
- Wiki Variables
- TWiki Formatted Search
- File Attachments
- TWiki Forms
- TWiki Templates
- TWiki Skins
- TWiki Meta Data
- TWiki Add-Ons
- TWiki Contribs
- TWiki Plugins
- Overview
- Installing Plugins
- Managing Installed Plugins
- The TWiki Plugin API
- Creating Plugins
- Recommended Storage of Plugin Specific Data
- Integrating with
configure
- Maintaining Plugins
- Environment
- Preferences
- User Handling and Access Control
- Webs, Topics and Attachments
- getListOfWebs( $filter ) -> @webs
- webExists( $web ) -> $boolean
- createWeb( $newWeb, $baseWeb, $opts )
- moveWeb( $oldName, $newName )
- eachChangeSince($web, $time) -> $iterator
- getTopicList( $web ) -> @topics
- topicExists( $web, $topic ) -> $boolean
- checkTopicEditLock( $web, $topic, $script ) -> ( $oopsUrl, $loginName, $unlockTime )
- setTopicEditLock( $web, $topic, $lock )
- saveTopic( $web, $topic, $meta, $text, $options ) -> $error
- saveTopicText( $web, $topic, $text, $ignorePermissions, $dontNotify ) -> $oopsUrl
- moveTopic( $web, $topic, $newWeb, $newTopic )
- getRevisionInfo($web, $topic, $rev, $attachment ) -> ( $date, $user, $rev, $comment )
- getRevisionAtTime( $web, $topic, $time ) -> $rev
- readTopic( $web, $topic, $rev ) -> ( $meta, $text )
- readTopicText( $web, $topic, $rev, $ignorePermissions ) -> $text
- attachmentExists( $web, $topic, $attachment ) -> $boolean
- readAttachment( $web, $topic, $name, $rev ) -> $data
- saveAttachment( $web, $topic, $attachment, $opts )
- moveAttachment( $web, $topic, $attachment, $newWeb, $newTopic, $newAttachment )
- Assembling Pages
- readTemplate( $name, $skin ) -> $text
- loadTemplate ( $name, $skin, $web ) -> $text
- expandTemplate( $def ) -> $string
- writeHeader( $query, $contentLength )
- redirectCgiQuery( $query, $url, $passthru )
- addToHEAD( $id, $header )
- expandCommonVariables( $text, $topic, $web, $meta ) -> $text
- renderText( $text, $web ) -> $text
- internalLink( $pre, $web, $topic, $label, $anchor, $createLink ) -> $text
- E-mail
- Creating New Topics
- Special handlers
- Searching
- Plugin-specific file handling
- General Utilities
- StaticMethod sanitizeAttachmentName ($fname) -> ($fileName,$origName)
- Deprecated functions
- TWiki CGI and Command Line Scripts
- TWiki Site Tools
- Managing Topics
- Managing Webs
- Manage Users
- Appendix A: TWiki Development Time-line
- Appendix B: Encode URLs With UTF8
- Appendix C: TWiki CSS
Syntax
Two parameters can be used to specify a customized search result:
1. header="..."
parameter
Use the header parameter to specify the header of a search result. It should correspond to the format of the format parameter. This parameter is optional.
Example:
header="| *Topic:* | *Summary:* |"
Variables that can be used in the header string:
Name: |
Expands To: |
$web |
Name of the web |
$n or $n() |
New line. Use $n() if followed by alphanumeric character, e.g. write Foo$n()Bar instead of Foo$nBar |
$nop or $nop() |
Is a "no operation". This variable gets removed; useful for nested search |
$quot |
Double quote (" ) (\" also works) |
$percnt |
Percent sign (% ) |
$dollar |
Dollar sign ($ ) |
2. format="..."
parameter
Use the format parameter to specify the format of one search hit.
Example:
format="| $topic | $summary |"
Variables that can be used in the format string:
Name: |
Expands To: |
$web |
Name of the web |
$topic |
Topic name |
$topic(20) |
Topic name, "- " hyphenated each 20 characters |
$topic(30, -<br />) |
Topic name, hyphenated each 30 characters with separator "-<br />" |
$topic(40, ...) |
Topic name, shortended to 40 characters with "..." indication |
$parent |
Name of parent topic; empty if not set |
$parent(20) |
Name of parent topic, same hyphenation/shortening like $topic() |
$text |
Formatted topic text. In case of a multiple="on" search, it is the line found for each search hit. |
$locked |
LOCKED flag (if any) |
$date |
Time stamp of last topic update, e.g. 25 Jan 2021 - 05:27 |
$isodate |
Time stamp of last topic update, e.g. 2021-01-25T05:27Z |
$rev |
Number of last topic revision, e.g. 4 |
$username |
Login name of last topic update, e.g. jsmith |
$wikiname |
Wiki user name of last topic update, e.g. JohnSmith |
$wikiusername |
Wiki user name of last topic update, like Main.JohnSmith |
$createdate |
Time stamp of topic revision 1 |
$createusername |
Login name of topic revision 1, e.g. jsmith |
$createwikiname |
Wiki user name of topic revision 1, e.g. JohnSmith |
$createwikiusername |
Wiki user name of topic revision 1, e.g. Main.JohnSmith |
$summary |
Topic summary, just the plain text, all formatting and line breaks removed; up to 162 characters |
$summary(50) |
Topic summary, up to 50 characters shown |
$summary(showvarnames) |
Topic summary, with %ALLTWIKI{...}% variables shown as ALLTWIKI{...} |
$summary(noheader) |
Topic summary, with leading ---+ headers removed Note: The tokens can be combined, for example $summary(100, showvarnames, noheader) |
$changes |
Summary of changes between latest rev and previous rev |
$changes(n) |
Summary of changes between latest rev and rev n |
$formname |
The name of the form attached to the topic; empty if none |
$formfield(name) |
The field value of a form field; for example, $formfield(TopicClassification) would get expanded to PublicFAQ . This applies only to topics that have a TWikiForm |
$formfield(name, 10) |
Form field value, "- " hyphenated each 10 characters |
$formfield(name, 20, -<br />) |
Form field value, hyphenated each 20 characters with separator "-<br />" |
$formfield(name, 30, ...) |
Form field value, shortended to 30 characters with "..." indication |
$pattern(reg-exp) |
A regular expression pattern to extract some text from a topic (does not search meta data; use $formfield instead). In case of a multiple="on" search, the pattern is applied to the line found in each search hit. • Specify a RegularExpression that covers the whole text (topic or line), which typically starts with .* , and must end in .* • Put text you want to keep in parenthesis, like $pattern(.*?(from here.*?to here).*) • Example: $pattern(.*?\*.*?Email\:\s*([^\n\r]+).*) extracts the e-mail address from a bullet of format * Email: ... • This example has non-greedy .*? patterns to scan for the first occurance of the Email bullet; use greedy .* patterns to scan for the last occurance • Limitation: Do not use .*) inside the pattern, e.g. $pattern(.*foo(.*)bar.*) does not work, but $pattern(.*foo(.*?)bar.*) does • Note: Make sure that the integrity of a web page is not compromised; for example, if you include an HTML table make sure to include everything including the table end tag |
$count(reg-exp) |
Count of number of times a regular expression pattern appears in the text of a topic (does not search meta data). Follows guidelines for use and limitations outlined above under $pattern(reg-exp) . Example: $count(.*?(---[+][+][+][+]) .*) counts the number of <H4> headers in a page. |
$n or $n() |
New line. Use $n() if followed by alphanumeric character, e.g. write Foo$n()Bar instead of Foo$nBar |
$nop or $nop() |
Is a "no operation". This variable gets removed; useful for nested search |
$quot |
Double quote (" ) (\" also works) |
$percnt |
Percent sign (% ) |
$dollar |
Dollar sign ($ ) |
Examples
Here are some samples of formatted searches. The
SearchPatternCookbook has other examples, such as
creating a picklist of usernames,
searching for topic children and more.
Bullet list showing topic name and summary
Write this:
%SEARCH{ "FAQ" scope="topic" nosearch="on" nototal="on" header=" * *Topic: Summary:*" format=" * [[$topic]]: $summary" }%
To get this:
- Topic: Summary:
- TWikiFAQ: Frequently Asked Questions About TWiki This is a real FAQ, and also a demo of an easily implemented knowledge base solution. To see how it's done, view the source ...
- TWikiFaqTemplate: FAQ: Answer: Back to: TWikiFAQ
- TextFormattingFAQ: Text Formatting FAQ The most frequently asked questions about text formatting are answered. Also, TextFormattingRules contains the complete TWiki shorthand system ...
Table showing form field values of topics with a form
In a web where there is a form that contains a
TopicClassification
field, an
OperatingSystem
field and an
OsVersion
field we could write:
| *Topic:* | *OperatingSystem:* | *OsVersion:* |
%SEARCH{ "[T]opicClassification.*?value=\"[P]ublicFAQ\"" scope="text" type="regex" nosearch="on" nototal="on" format="| [[$topic]] | $formfield(OperatingSystem) | $formfield(OsVersion) |" }%
To get this:
Extract some text from a topic using regular expression
Write this:
%SEARCH{ "__Back to\:__ TWikiFAQ" scope="text" type="regex" nosearch="on" nototal="on" header="TWiki FAQs:" format=" * $pattern(.*?FAQ\:[\n\r]*([^\n\r]+).*) [[$topic][Answer...]]" }%
To get this:
TWiki FAQs:
- How can I create a simple TWiki Form based application? Answer...
- How do I delete or rename a topic? Answer...
- How do I delete or rename a file attachment? Answer...
- Why does the topic revision not increase when I edit a topic? Answer...
- TWiki has a GPL (GNU General Public License). What is GPL? Answer...
- I've problems with the WebSearch. There is no Search Result on any inquiry. By clicking the Index topic it's the same problem. Answer...
- What happens if two of us try to edit the same topic simultaneously? Answer...
- I would like to install TWiki on my server. Can I get the source? Answer...
- What does the "T" in TWiki stand for? Answer...
- So what is this WikiWiki thing exactly? Answer...
- Everybody can edit any page, this is scary. Doesn't that lead to chaos? Answer...
Nested Search
Search can be nested. For example, search for some topics, then form a new search for each topic found in the first search. The idea is to build the nested search string using a formatted search in the first search.
Here is an example. Let's search for all topics that contain the word "culture" (first search), and let's find out where each topic found is linked from (second search).
- First search:
-
%SEARCH{ "culture" format=" * $topic is referenced by: (list all references)" nosearch="on" nototal="on" }%
- Second search. For each hit we want this search:
-
%SEARCH{ "(topic found in first search)" format="$topic" nosearch="on" nototal="on" separator=", " }%
- Now let's nest the two. We need to escape the second search, e.g. the first search will build a valid second search string. Note that we escape the second search so that it does not get evaluated prematurely by the first search:
- Use
$percnt
to escape the leading percent of the second search
- Use
\"
to escape the double quotes
- Use
$dollar
to escape the $
of $topic
- Use
$nop
to escape the }%
sequence
Write this:
%SEARCH{ "culture" format=" * $topic is referenced by:$n * $percntSEARCH{ \"$topic\" format=\"$dollartopic\" nosearch=\"on\" nototal=\"on\" separator=\", \" }$nop%" nosearch="on" nototal="on" }%
To get this:
- ATasteOfTWiki is referenced by:
- FormattedSearch is referenced by:
- ActionTrackerPlugin, BlackListPlugin, CalendarPlugin, ChartPlugin, EditTablePlugin, EmptyPlugin, ExcelImportExportPlugin, FormPlugin, FormatTokens, HeadlinesPlugin, HolidaylistPlugin, InterwikiPlugin, LatexModePlugin, LdapNgPlugin, MathModePlugin, PreferencesPlugin, QuerySearch, RenderListPlugin, RequireRegistrationPlugin, SearchEngineKinoSearchPlugin, SearchHelp, SearchPatternCookbook, SlideShowPlugin, SmiliesPlugin, SpreadSheetPlugin, TWikiAccessControl, TWikiDocumentation, TWikiForms, TWikiHistory, TWikiMetaData, TWikiNetSkinPlugin, TWikiReferenceManual, TWikiReleaseNotes04x00, TWikiReleaseNotes04x01, TWikiScripts, TWikiSearchDotPm, TWikiSiteTools, TWikiUISearchDotPm, TagMePlugin, ThumbnailPlugin, TopicCreatePlugin, TreeBrowserPlugin, TreePlugin, TwistyPlugin, VarCachePlugin, VarMETA, VarMETASEARCH, VarSEARCH, VarURLPARAM, WebStatistics, WelcomeGuest
- TWikiAccessControl is referenced by:
- EditTablePlugin, FileAttachment, MainFeatures, ManagingTopics, ManagingUsers, SitePermissions, SourceCode, TWikiAccessControl, TWikiDocumentation, TWikiForms, TWikiFuncDotPm, TWikiHistory, TWikiPreferences, TWikiReferenceManual, TWikiReleaseNotes04x01, TWikiReleaseNotes04x02, TWikiScripts, TWikiSiteTools, TWikiTopics, TWikiUserAuthentication, TWikiVariables, VarSEARCH, WebPreferences, WebPreferencesHelp, WebStatistics, WikiCulture, WikiWord
- TWikiSite is referenced by:
- AdminToolsCategory, InstantEnhancements, InterwikiPlugin, ManagingWebs, StartingPoints, TWikiDocumentation, TWikiGlossary, TWikiI18NDotPm, TWikiInstallationGuide, TWikiPreferences, TWikiReferenceManual, TWikiRegistration, TWikiReleaseNotes04x02, TWikiScripts, TWikiSite, TWikiTopics, TWikiTutorial, TWikiUserAuthentication, WabiSabi, WebSiteTools, WebStatistics, WhatDoesTWikiStandFor, WhatIsWikiWiki, WikiCulture, WikiReferences
- VarCachePluginTest is referenced by:
- WabiSabi is referenced by:
- WhatIsWikiWiki is referenced by:
- WikiCulture is referenced by:
Note: Nested search can be slow, especially if you nest more then 3 times. Nesting is limited to 16 levels. For each new nesting level you need to "escape the escapes", e.g. write
$dollarpercntSEARCH{
for level three,
$dollardollarpercntSEARCH{
for level four, etc.
Most recently changed pages
Write this:
%SEARCH{ "\.*" scope="topic" type="regex" nosearch="on" nototal="on" order="modified" reverse="on" format="| [[$topic]] | $wikiusername | $date |" limit="7" }%
To get this:
Search with conditional output
A regular expression search is flexible, but there are limitations. For example, you cannot show all topics that are up to exactly one week old, or create a report that shows all records with invalid form fields or fields within a certain range, etc. You need some additional logic to format output based on a condition:
- Specify a search which returns more hits then you need
- For each search hit apply a spreadsheet formula to determine if the hit is needed
- If needed, format and output the result
- Else supress the search hit
This requires the
TWiki:Plugins.SpreadSheetPlugin. The following example shows all topics that are up to exactly one week old.
Write this:
%CALC{$SET(weekold, $TIMEADD($TIME(), -7, day))}%
%SEARCH{ "." scope="topic" type="regex" nosearch="on" nototal="on" order="modified" reverse="on" format="$percntCALC{$IF($TIME($date) < $GET(weekold), <nop>, | [[$topic]] | $wikiusername | $date | $rev |)}$percnt" limit="100" }%
- The first line sets the
weekold
variable to the serialized date of exactly one week ago
- The SEARCH has a deferred CALC. The
$percnt
makes sure that the CALC gets executed once for each search hit
- The CALC compares the date of the topic with the
weekold
date
- If topic is older, a
<nop>
is returned, which gets removed at the end of the TWiki rendering process
- Otherwise, the search hit is formatted and returned
To get this:
Embedding search forms to return a formatted result
Use an HTML form and an embedded formatted search on the same topic. You can link them together with an
%URLPARAM{"..."}%
variable. Example:
Write this:
<form action="%SCRIPTURLPATH{"view"}%/%WEB%/%TOPIC%">
Find Topics:
<input type="text" name="q" size="32" value="%URLPARAM{"q"}%" /> <input type="submit" class="twikiSubmit" value="Search" />
</form>
Result:
%SEARCH{ search="%URLPARAM{"q"}%" format=" * $web.$topic: %BR% $summary" nosearch="on" }%
To get this:
Result:
Related Topics: UserDocumentationCategory,
SearchHelp,
TWikiVariables#VarSEARCH,
SearchPatternCookbook,
RegularExpression
--
Contributors: TWiki:Main.PeterThoeny,
TWiki:Main.CrawfordCurrie
Back to top
File Attachments
Each topic can have one or more files of any type attached to it by using the Attach screen to upload (or download) files from your local PC. Attachments are stored under revision control: uploads are automatically backed up; all previous versions of a modified file can be retrieved.