You can put comments anywhere in your TypoScripts. Comments are always ignored by the parser when the template is processed. But the backend module Web>TS has the ability to utilize comments in a constant-editor that makes simple configuration of a template even easier than constants in them selves make it.
When the TS "Constant Editor" parses the template, all comments before every constant-definition is registeret. In the constants you can follow a certain syntax to define what category the constant should be in, which type it has and what explaination there is about the constant. This is an example:
styles.content.textStyle {# cat=content/cText/1; type=; label= Bodytext font: This is the fontface used for text!
face =
# cat=content/cText/2; type=int[1-5]; label= Bodytext size
size =
# cat=content/cText/3; type=color; label= Bodytext color
color =
color1 =
color2 =
properties =
}
It's totally optional to make the comments before your constants compliant with this system, but it's very useful lateron if you want others to make simple corrections to your template or distribute the template in a template-archive or such.
The default value of a constant is determined by the value the constant has BEFORE the last template (the one you're manipulating with the module) is parsed (previous templates are typically included static_template-records!), unless the mark ###MOD_TS:EDITABLE_CONSTANTS### is found in the last template, in which case constant-definitions before this mark is also regarded default-values.
This means that all constant values - or values after the mark ###MOD_TS:EDITABLE_CONSTANTS### if present - in the template-record you're manipulating is regarded to be your customized extensions.
How the comments are percieved by the module:
- All comments set on lines before the constant whereever it's found in the templates are parsed sequentially.
- Each line is split by the ";" (semicolon) character, that separates the various parameters
- Each parameter is split by the "=" (equal) sign to separate the parameter "key" and the "value".
cat=
- Comma-separated list of the categories (caseinsensitive) that the constant is a member of. You should list only one category, because it usually turns out to be confusing for users, if a constant appears in multiple categories!
- If category is not found among the default categories listed below, it's regarded a new category
- If the category is empty (""), the constant is excluded by the editor!
basic:
Constants of superior importance for the template-layout. This is dimensions, imagefiles and enabling of various features. The most basic constants, which you would almost always want to configure.
menu:
Menu setup. This includes fontfiles, sizes, background images. Depending on the menutype.
content:
All constants related to the display of pagecontent elements
page:
General configuration like metatags, link targets
advanced:
Advanced functions, which are used very seldomly.
There are a number of subcategories to use. Subcategories are entered after the category-name separated by a slash "/". Example: "basic/color/a"
This will make the constant go into the "BASIC"-category, be listed under the "COLOR"-section and probably be one of the top-constants listed, because the "a" is used to sort the constants in a subcategory. If "a" was not entered, the default is "z" and thus it would be one of the last colors to select. As the third parameter here, you can choose whatever you like.
Subcategories must be one of these. If not, it'll not be create as it's the case with categories, but the constant will just go into the subegory "Other".
Here is the current subcategories
Standard subcategories (in the order listed in Typo3):
enableUsed for options that enable or disable primary functions of a template
dimsDimensions of all kinds; pixels, widths, heights of images, frames, cells and so on.
fileFiles like background images, fonts and so on. Other options related to the file may also enter
typoTypography and related constants
colorColor setup. Many colors will be found with related options in other categories though.
linksLinks: Targets typically
languageLanguage specific options.
Subcategories based on the default content elements
cheader,cheader_g,ctext,ctextpic,cimage,cbullets,ctable,cuploads,cmultimedia,cmailform,csearch,clogin,csplash,cmenu,cshortcut,clist,cscript,chtml
These are all categories reserved for options that relate to content rendering for each type of tt_content element. See static_template "content (default)" and "styles.content (default)" for examples.
int [low-high]integer, opt. in range "low" to "high"
int+ positive integer
offset[L1,L2,...L6]comma-separated integers. Default is “x,y”, but as comma separated parameters in brackets you can specify up to 6 labels being comma separated! If you wish to omit one of the last 4 fields, just don't enter a label for that element.
colorHTML color
wrapHTML-code that is wrapped around some content.
options [item1,item2,...]Selectbox with values/labels item1, item2 etc. Commaseparated. Split by "=" also and in that case, first part is label, second is value
boolean [truevalue]Boolean, opt. you can define the value of "true", def.=1
comment Boolean, checked= "", not-checked = "#".
file [ext-list/IMAGE_EXT]Selectorbox with resources. Opt. list allowed extensions (no space in list!), eg. "[ttf]" or "[txt,html,htm]". You can also enter "[IMAGE_EXT]" in which case the default image-extensions are listed. (used for datatype "imgResouce")
string (the default)Just a string value
In addition to using constants, you can also configure a category in the constant editor by a special toplevel TypoScript "object" in the constants-field. The name is "TSConstantEditor" and any properties to this object will NOT be substituted like any other constant normally would.
Property: | Data type: | Description: | Default: |
|---|---|---|---|
header | string | Header, displayed in upper-case | |
description | string, break by // | Description, enter "//" to make a linebreak | |
bulletlist | string, break by // | Lines for a bulletlist, enter "//" (double-slash) in order to break to next bullet | |
image | image | This is an optional image you can attach to the category. The image would normally show a given configuration of the template and contain numberet marks, that indicate positions that are referred to by the constants, listed in the number-array. The image must be located in "gfx/" in the module path OR be a file from the resource-list of the template. | |
Array, 1-20 | list of constant-names | Each number refers to a number-mark on the image and all constants that are listed at each number will get a little number-icon by it's header. |
## TSConstantsEditor Config
TSConstantEditor.basic {header = Standard Template "BUSINESS"
description = BUSINESS is a framebased template in a very simple layout, based on ....
bulletlist = Left-frame image in the top. The dimensions are fixed to ....
image = gfx/BUSINESS_basic.gif
1=leftFrameWidth,menu.file.bgImg,menu.bgCol
2=page.file.bgImg,bgCol
3=contentOffset
4=file.logo
5=page.L0.titleWrap
6=page.L1.titleWrap
7=contentWidth,styles.content.imgtext.maxW
8=page.lineCol
}
This example shows how the static_template BUSINESS is configured for the basic-module. This is how it looks in Typo3: