Everything else is identical. Both understand the same suffixes, both are written the same way, both behave the same way. This page therefore describes both together and writes
DC-FPX wherever DC-SPX applies equally.
The
X in the tag name is a placeholder that you fill in yourself. DC-FP1, DC-FPfarbe and DC-FPmeinWert are three different parameters. Digits, letters and combinations of both are allowed, up to 20 characters long.The pattern in three steps
A free parameter is set, used and released again.The comparison in the brackets is case-insensitive.
{DC-FP1(Blau)} also applies to the values blau and BLAU. The same goes for the tag name itself and for all suffixes: ~DC-FP1_HexEncode~ and ~DC-FP1_hexencode~ are the same tag.Brackets without a parameter mean “is filled”
If you leave the brackets empty, the tag only checks whether any value is set at all.This is the usual way to combine several conditions into one switch: set the same tag in several places, then bracket on it once.
The complete example
A nutrition table should only appear if at least one of four custom product data fields is filled. The query has to enclose the entire block, so the switch is set beforehand.FP or SP
UseDC-FP as long as the value does not leave the page. That is the normal case.
You need DC-SP when the value must still be there on a subsequent page, for example a selection the buyer makes on the product page that should still apply in the basket.
There is a configurable upper limit for the number of
DC-SP parameters. If it is exceeded, the shop no longer creates further parameters, writes a critical error to the log, and the tag has no effect. This limit does not apply to DC-FP.The output is HTML-encoded
Every free parameter is HTML-encoded on output. If you set~DC-FP1_set(&)~, & appears on the page.
Only if you really need the value unchanged and have made sure yourself that it is harmless should you lift the encoding for exactly one output.
Taking values from other tags
DC-FPX_set() accepts not only fixed text but also the result of another single tag. To do this, replace its tildes with dollar signs.
The suffixes
All suffixes work on the value currently stored in the parameter. What matters is whether a suffix changes the stored value or only outputs it in modified form.This distinction saves most debugging.
~DC-FP1_touppercase~ outputs nothing but converts the stored value to uppercase. Only the subsequent ~DC-FP1~ displays it. Conversely, ~DC-FP1_base64encoding~ leaves the value untouched and only outputs the encoded version.Changing the value
_set()
Stores the value. An existing value is replaced._reset
Clears the slot. Afterwards, the same parameter can be set again._reset is written without brackets. The older notation DC-FPX_reset() can still be found in cross-references in the previous documentation._append()
Appends to the existing value. This is the way around the 128-character limit that applies to every WEBSALE tag._replace()
Searches and replaces. Two comma-separated arguments: first the string to search for, then its replacement. If the second argument is empty, the string is deleted._slice()
Cuts out a section. Counting starts at 0; the first number is included, the second is not. If the second number is missing, the cut goes to the end._truncate()
Truncates after the specified number of characters._extractTaggedData()
Cuts out what is between two markers. Both arguments support tag-in-tag._convertToEncoding()
Converts the character set. First the source, then the target character set. Useful when data goes to an external system that expects a different character set._touppercase and _tolowercase
Convert the stored value to uppercase or lowercase letters. Neither outputs anything itself.Outputting the value
_length
Outputs the number of characters._IndexOf() and _RIndexOf()
Output the position of a string:_IndexOf() that of the first occurrence, _RIndexOf() that of the last. Counting starts at 0; not found results in -1.
Encodings
Seven suffixes output the value in a different encoding without changing it._linknameencoding
Outputs the value according to the rules you have defined in the<LinkNameEncoding> section of the shop configuration shop.config for the readable part of your URLs.
<LinkNameEncoding> section
_encodeISO2HTML
Outputs all characters outside ASCII as decimal HTML entities._StripHTML
Outputs the value without HTML markup and without quotation marks. Intended for fields that require plain text, for example a meta description.The stored value remains unchanged. A later
~DC-FPbeschreibung~ outputs the version with HTML again._encrypt() and _hash()
Output the value encrypted or as a checksum so that it can be passed securely to an external system. The stored value remains unchanged._encrypt() expects two arguments, optionally a third.
_hash() expects three arguments, optionally a fourth.
The content of the parameter is hashed with the secret from the configuration appended. The result is encoded and output.
<DesignControl> section
Checking
_contains()
Applies if the specified string occurs anywhere in the value. UnlikeDC-CompareStringInList(), no complete match is required. Case does not matter.
This lets you address a group of categories by their name instead of maintaining category indexes by hand. If a new shirt category is added, the bracket applies without any change to the template.
_verifyChecksum()
Checks the checksum of an invoice or address number from the D&G merchandise management system. The argument isDuG-AdrNr or DuG-ReNr.
Passing on names and values
A parameter whose name itself comes from a tag cannot be read directly. For this purpose, there is_touch and the three associated retrieval tags: _touch remembers the name and value of the most recently addressed parameter, and afterwards you retrieve both individually.
The four tags exist separately for both kinds:
DC-FP_lastKeyTouched and DC-SP_lastKeyTouched keep their own memory. A _touch on a DC-FP does not change the memory on the DC-SP side.Limits
Tags with other prefixes
The tags at a glance
The table applies equally toDC-FPX and DC-SPX.
All tags are permitted on all templates.
The previous documentation does not list six suffixes for
DC-SP that exist for DC-FP: _jsonencoding, _length, _tolowercase, _touppercase, _urldecoding and _verifyChecksum. In the shop, the same code processes both prefixes, so all suffixes are equally available for DC-SP.Related topics
- Guide: Using free parameters
- Reference: DC- (counters and calculations)
- Reference: DC- (loops)
- Reference: DC- (comparisons and other tags)
- Basics: Tag basics
