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 name | Conditions |
|---|---|
| adminLoggedIn | The admin is logged in to the admin panel. |
| CustomerLoggedIn | The customer is logged in to the online store. |
| MultiPageCheckout | The online store uses the multi-page checkout. |
| SinglePageCheckout | The online store uses the single-page checkout. |
| ProductID-n | The customer is on the product page. n is the ID number of the product in question. |
| CategoryID-n | The customer is on the product category page. n is the product category ID number. |
| MainCategoryID-n | The customer is on the product category page. n is the ID number of the supercategory of the product category. |
| NewsPageID-n | The customer is on the news page. n is the ID number of the news page. |
| CampaignID-n | The customer is on the campaign page. n is the campaign ID number. |
| BrandID-n | The customer is on the brand page. n is the ID number of the brand. |
| VersionID-n | Version 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
beforeandafterattributes, 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
beforeandafterattributes 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.'
