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.

Often, the class names produced by the {BodyClass} tag are printed on the <body> element, but the tag can be used on any element and in multiple places as needed.

Syntaksi

{BodyClass}

Näkyvyys

Toimii näkyvyydessä: globaali

It is possible to use global visibility tags in any page template and within any tag.

Class names to be printed

The {BodyClass} tag outputs the following class names depending on the user's location and state in 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 the product page. n is the ID number of the product in question.
CategoryID-nThe customer is on the product category page. n is the product category ID number.
MainCategoryID-nThe customer is on the product category page. n is the ID number of the supercategory of the product category.
NewsPageID-nThe customer is on the news page. n is the ID number of the news page.
CampaignID-nThe customer is on the campaign page. n is the campaign ID number.
BrandID-nThe customer is on the brand page. n is the ID number of the 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

before/after:

With the before and after attributes, you can define content that is output before or after the content produced by the tag.

Allowed values: text that may contain HTML and Interface markup.

E.g.

  • before: '<p>This markup appears before the tag's own content.</p>'.
  • after: '<p>This appears after the tag's own content.</p>'

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

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: text that may contain HTML and Interface markup.

E.g. or:'Content not found.'