> ## Documentation Index
> Fetch the complete documentation index at: https://dokumentation.websale.de/llms.txt
> Use this file to discover all available pages before exploring further.

# Basics of tags

In WEBSALE V8s, a tag is a placeholder in a template that is replaced with a specific value during live operation. For example, the tag `~PR-Name~` is replaced with the product name of the currently selected product.

To display all products in the shop with a single template, for instance, we do not include the explicit product properties in the template — instead we use a placeholder in that spot: a WEBSALE tag. For every product property and other values to be replaced, such as company name or category name, there is a dedicated tag. This way, you don't have to create a separate template for every product, and any changes don't need to be made on each individual product template.

WEBSALE distinguishes the following types of tags:

* Single tag: `~Tag~`
* Range tag: `{Tag}.........{/Tag}`
* Negative range tag: `{!Tag}.........{/!Tag}`
* Loop tag: `{@Tag}.........{/@Tag}`

There is also the option of nesting tags within one another (tag-in-tag). The following sections introduce the tag types in turn. A note on the tag length limit rounds off the topic.

The usability of the individual tag types can be found in each tag's description in the "Reference" section of this documentation.&#x20;

## Single tag: `~Tag~`

A single tag is replaced with a value. That is, the contained value is output.

Example: `~PR-Name~` is replaced with the product name.

## Range tag: `{Tag}.........{/Tag}`

A range tag brackets a template section that WEBSALE V8s shows or hides depending on whether the tag of the same name contains a value or not.

Example: while most WEBSALE V8s tags are fixed, you can, for instance, define product-related tags yourself as needed. If a freely defined field Akku contains any value, for example 500, everything between the brackets `{PR-Akku}...{/PR-Akku}` is shown. This can be, for example, an HTML table row containing fixed text.

That text is only displayed when a value has been entered in the corresponding field of the product. As a rule, the tag for the associated field (in the example `~Akku~`; the shop software turns this tag into `~PR-Akku~` when used on a product page) is used within the range tags. For example, `{PR-Akku} Battery life: ~PR-Akku~ mAh {/PR-Akku}` results in the display "Battery life: 500 mAh".

## Negative range tag: `{!Tag}.........{/!Tag}`

A negative range tag has the reverse logic of a range tag. If a parameter has no value, the negative range is shown.

Example: if a freely defined field Akku contains no value, everything between the brackets `{!PR-Akku}...{/!PR-Akku}` is shown. This can be, for example, a table row containing the static text "Device without battery". This text is then only displayed if the corresponding product field contains no value. For example, `{!PR-Akku} Device without battery {/!PR-Akku}` results in the display "Device without battery" when no value has been entered for the product's Akku field.

## Loop tag: `{@Tag}.........{/@Tag}`

In many situations, sections of a template need to be run through multiple times, for example to list all products of a category or all subcategories of a category. For this purpose, WEBSALE V8s provides a special form of range tags, the so-called "loop tags". Loop tags are marked with a leading at sign ("@"), for example `@PR-Data`.

When you use a loop tag, the section is repeated as many times as the element referenced by the tag exists in the shop (quantity loop), and all data of the element is output on each iteration. WEBSALE V8s therefore performs automatic loop control by default. The designer does not have to worry about how many loop iterations are required to display all elements of a type or a set sequentially on a template.

Example: to display a list containing the product data of all products of a currently selected category, you define a loop `{@PR-Data}` within the range for the category `{CAT-Data}`. The number of loop iterations is determined automatically by the number of products available in this category:

```text theme={"theme":{"light":"github-light","dark":"github-dark"},"languages":{"custom":["/languages/websale.json"]}}
...
{CAT-Data}
   {@PR-Data}
      ....
      Display of product data
      ....
   {/@PR-Data}
{/CAT-Data}
...
```

Once WEBSALE V8s has run through a loop the required number of times, it continues with the template code that follows.

Only suitable range tags can be used as a loop tag. Whether a tag can be used as a loop tag is stated in the tag description (reference).

As a supplement to automatic loop control (for example `PR-Data`), WEBSALE V8s provides special DC-Loop tags that designers can use to create their own counting loops to control processes individually.&#x20;

## Tag-in-tag

With some tags it is possible to also use a further tag inside the argument.

If you use any single tag inside the argument of a tag, you must replace the normal tag delimiters (tilde characters) with dollar signs.

Example: a calculation is to be performed based on the product price. The tag `DC-CommercialCalc1_set()` is tag-in-tag capable. That is, a tag can be used as its argument — in this case the tag for the product price (`PR-Price`).

```html theme={"theme":{"light":"github-light","dark":"github-dark"},"languages":{"custom":["/languages/websale.json"]}}
...
~DC-CommercialCalc1_set($PR-Price$)~     <!-- Starting value of our calculation is the product price -->
~DC-CommercialCalc1_add(3)~              <!-- 3 is added -->
Result: ~DC-CommercialCalc1~             <!-- Displays the result (product price + 3) -->
...
```

## Special notes on using tags

### Tag length limit

The maximum length of a tag, including argument list, is 128 characters in WEBSALE V8s.&#x20;

Using the DC-Append tags, character strings that exceed the maximum tag length can be split up and processed correctly. The procedure is illustrated in the reference under DC-FP1…5\_append.&#x20;


## Related topics

- [How does WEBSALE V8s work?](https://dokumentation.websale.de/en/v8s/wie-funktioniert-websale-v8s.md)
- [Counters and comparisons in the template](https://dokumentation.websale.de/en/v8s/fortgeschrittene-designtechniken/zaehler-und-vergleiche-im-template.md)
- [Use cases](https://dokumentation.websale.de/en/v8s/anwendungsbeispiele/anwendungsbeispiele.md)
- [Basics and technology](https://dokumentation.websale.de/en/v8s/referenz/konfigurationen/shopkonfiguration-shop-config/grundlagen-und-technik.md)
- [PR- (Basics and product data)](https://dokumentation.websale.de/en/v8s/referenz/tags/pr/grundlagen-und-produktdaten.md)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.