Creating templates

NSM Body Class is intended to be used with an embedded "header" template.

  1. Create a new _partials template group and .header template.
  2. Add the {exp:nsm_body_class} tag to the _partials/.header template:
    <body {exp:nsm_body_class}>
  3. Embed the _partials/.header template inside a primary template and add an embed parameter:
    {embed='_partials/.header' entry_id='10'}
  4. Request the primary template in your browser and the html <body> tag will look like:
    <body class='e-10'>

Adding a new key to the parameter map

In some cases you may want to add a new key to the parameter map. In the example below we'll extend the parameter map and add the "category" key.

Continuing from the example above add the parameter_map parameter to the {exp:nsm_body_class} tag in the _partials/.header template:

<body {exp:nsm_body_class parameter_map="category:cat"}>

Update the parent template to pass through the new category parameter:

{embed='_partials/.header' entry_id='10' category='cars'}

The HTML output will now look like:

<body class='e-10 cat-cars'>
Releases RSS Feed © Copyright 2017 | Policies All prices shown are in Australian Dollars ($AUD) Newism