Thalassa CMS logo

Thalassa CMS

Simple pages

Contents:

The [page NNN] section group

Sections of the [page NNN] group are used to generate stand-alone HTML pages as well as almost arbitrary text files residing within your site's tree.

The name of the file to generate is defined by the section name, it is that NNN thing, relative to your site's tree root (see the [general]/rootdir parameter description). Yes, dots and slashes are okay in the name, so, for example, you can have something like this:

  [page img/.htaccess]
  body = Options +Indexes
  +

(the “+” is needed to make sure the file is correctly ended with a newline character).

There are two ways to generate a page: on its own or by expanding a template (defined by the appropriate [template NNN] section). Creating a page without a template involves parameter named body, which specifies the text to be placed into the file. Macroprocessing is done on its value, so you can use HTML snippets and other things available through macros. All other parameters are silently ignored, provided that there's no parameter named “template”.

To generate the page (or a generic file) using a template, the template parameter must be given; its value specifies the template identifier. If this parameter is present, the body parameter will not be used for generation and will be ignored in case it is given (strictly speaking, this is true unless the template being used depends on an argument named “body”, but this is strongly discouraged to avoid confusing). Additional parameters may be specified as required for the template. This method of stand-alone page generation is described in the next section.

Whatever method is selected, you can affect the mode (that is, access permissions) for the generated file. This is done by specifying another parameter, named chmod, whose value is the desired mode value, represented by an octal number. For example, adding

  chmod = 600

to the section will make the file accessible (for reading and writing) to its owner only. This may be useful for files that are not web pages and are not intended to be accessible through the HTTP server; configuration file for the Thalassa CGI program gives a good example. Please note that the value is passed directly to the fchmod system call, so it is not affected by your current umask value.

Please note that macroprocessing is NOT done for the template and chmod parameters. In particular, the template parameter's value must be exactly equal to the appropriate [template ] section name. From the other hand, all parameters requested by the template are passed through the macroprocessor before processing the template.

The [template ID] section group

Sections headed as [template ID] (where ID is a template identifier) specify templates, which can be used to generate stand-alone pages of similar structure.

A section of this group has exactly two parameters:

Consider the following example:

  [template dont]
  params = subject epilogue
  body = Don't %subject% a %subject% until the %subject%
  +%subject%s you! %epilogue%

  [page trouble.txt]
  template = dont
  subject = trouble
  epilogue = Or else you'll have a trouble.

  [page cheat.txt]
  template = dont
  subject = cheat
  epilogue = Cheaters are stinky.

Two files will be generated: trouble.txt will contain

  Don't trouble a trouble until the trouble
  troubles you! Or else you'll have a trouble.

and cheat.txt will have

  Don't cheat a cheat until the cheat
  cheats you! Cheaters are stinky.

Please note that macroprocessing is NOT done for the params parameter's value. The body parameter is certainly passed through the macroprocessor to get the resulting text, and for this run the macroprocessor is supplied with simple (argument-less) macros for each of the words mentioned in the params, in addition to all macros available everywhere.

© Andrey V. Stolyarov, 2023, 2024