r1 - 2006-02-01 - 12:01:25 - TWikiContributorYou are here: NTP >  TWiki Web > TWikiTemplatesDotPm
NTP users are strongly urged to take immediate action to ensure that their NTP daemons are not susceptible to being used in distributed denial-of-service (DDoS) attacks. Please also take this opportunity to defeat denial-of-service attacks by implementing Ingress and Egress filtering through BCP38.

ntp-4.2.8p15 was released on 23 June 2020. It addresses 1 medium-severity security issue in ntpd, and provides 13 non-security bugfixes over 4.2.8p13.

Please see the NTP Security Notice for vulnerability and mitigation details.

Are you using Autokey in production? If so, please contact Harlan - he's got some questions for you.

Package TWiki::Templates

Support for the TWiki template language.

The following tokens are supported by this language:

%TMPL:P% Instantiates a previously defined template
%TMPL:DEF% Opens a template definition
%TMPL:END% Closes a template definition
%TMPL:INCLUDE% Includes another file of templates

Note; the template cache does not get reset during initialisation, so the haveTemplate test will return true if a template was loaded during a previous run when used with mod_perl or speedycgi. Frustrating for the template author, but they just have to switch off the accelerators during development.

This is to all intents and purposes a singleton object. It could easily be coverted into a true singleton (template manager).

ClassMethod new ($session)

Constructor. Creates a new template database object.

  • $session - session (TWiki) object

ObjectMethod haveTemplate ($name) -> $boolean

Return true if the template exists and is loaded into the cache

ObjectMethod expandTemplate ($params) -> $string

Expand the template specified in the parameter string using tmplP.


$tmpls->expandTemplate('context="view" then="sigh" else="humph"');

---++ ObjectMethod *tmplP* <tt>($attrs) -> $string</tt>

Return value expanded text of the template, as found from looking
in the register of template definitions. The attrs can contain a template
name in _DEFAULT, and / or =context=, =then= and =else= values.

Recursively expands any contained TMPL:P tags.

Note that it would be trivial to add template parameters to this,
simply by iterating over the other parameters (other than _DEFAULT, context,
then and else) and doing a s/// in the template for that parameter value. This
would add considerably to the power of templates. There is already code
to do this in the MacrosPlugin.

---++ ObjectMethod *readTemplate* <tt>($name,$skins,$web) -> $text</tt>

Return value: expanded template text

Reads a template, constructing a candidate name for the template thus
   0 looks for file =$name.$skin.tmpl= (for each skin)
      0 in =templates/$web=
      0 in =templates=, look for
   0 looks for file =$name.tmpl=
      0 in =templates/$web=
      0 in =templates=, look for
   0 if a template is not found, tries in this order
      0 parse =$name= into a web name (default to $web) and a topic name and looks for this topic
      0 looks for topic =${skin}Skin${name}Template= 
         0 in $web (for each skin)
         0 in =TWiki::cfg{SystemWebName}= (for each skin)
      0 looks for topic =${name}Template=
         0 in $web (for each skin)
         0 in =TWiki::cfg{SystemWebName}= (for each skin)
In the event that the read fails (template not found, access permissions fail)
returns the empty string ''.

=$skin=, =$web= and =$name= are forced to an upper-case first character
when composing user topic names.

If template text is found, extracts include statements and fully expands them.
Also extracts template definitions and adds them to the
list of loaded templates, overwriting any previous definition.

Edit | WYSIWYG | Attach | Printable | Raw View | Backlinks: Web, All Webs | History: r2 < r1 | More topic actions...
This site is powered by the TWiki collaboration platformCopyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding NTP? Send feedback
Note: Please contribute updates to this topic on TWiki.org at TWiki:TWiki.TWikiTemplatesDotPm