Prints a list of circumstance-dependable class names that are often given to the body element.

Kuvaus

The tag prints different class names depending on the circumstances. You can use it, for instance, to define different color themes to each main product category or make style changes to individual campaign products.

See the list of class names printed by the tag and their conditions.

Generally, the class names produced by the {BodyClass} tag are printed on the <body> element, but you can also use the tag in any element and in multiple locations to suit your needs.

Syntaksi

{BodyClass}

Näkyvyys

Toimii näkyvyydessä: globaali

Tags with global scope can be used on any template and in any tag.

Class names to be printed

The {BodyClass} tag prints the following class names depending on the user's location and the status of the online store:

Class nameConditions
adminLoggedInThe admin is logged in to the admin panel.
CustomerLoggedInThe customer is logged in to the online store.
MultiPageCheckoutThe online store uses the multi-page checkout.
SinglePageCheckoutThe online store uses the single-page checkout.
ProductID-nThe customer is on a product page. n is the ID number of that product.
CategoryID-nThe customer is on a product category page. n is the ID number of that product category.
MainCategoryID-nThe customer is on a product category page. n is the ID number of the main category in that product category.
NewsPageID-nThe customer is on a news page. n is the ID number of that news page.
CampaignID-nThe customer is on a campaign page. n is the ID number of that campaign.
BrandID-nThe customer is on a brand page. n is the ID number of that brand.
VersionID-nVersion ID number.

Printing class names in the body element

<body class="{BodyClass}">
...                  

This sample markup produces a list of space-separated class names in the body element:

<body class="MultiPageCheckout AdminLoggedIn CustomerLoggedIn InfoPageID-11 VersionID-1">
...                  

The example presents the following situation:

  • The visitor is an admin user that is logged in also as a customer.
  • The online store uses the multi-page checkout.
  • The visitor is on a news page with the ID number 11.

Attribuutit

after/before:

By using the after and before attributes you can define content that is output either after or before the tag's output.

Allowed values:The HTML and Interface markup

E.g.

  • before: '<p>Tämä merkkaus näkyy ennen tagin omaa sisältöä.</p>'
  • after: '<p>Tämä taas näkyy tagin oman sisällön jälkeen.</p>'

If the tag does not produce any content, neither the content of the after and before attributes will be output.

escape:

Adds an escape character before quotation marks in the output.

The attribute makes it easier to process the tag-produced content when using JavaScript.

Allowed values:true/false. The default value is false.

or:

Defines alternative content that is displayed if the tag itself does not produce any content.

Allowed values:The HTML and Interface markup

E.g. or:'Sisältöä ei löytynyt.'