title: Magento: show custom attribute in body class
body: <p>I have a custom category attribute that i want to add to the body class. As far as I could find out what people do is</p>
  
  <ol>
  <li><p>Override the CategoryController and add something like <code>$root-&gt;addBodyClass($category-&gt;getMyAttribute());</code> But I don't want to override core classes...</p></li>
  <li><p>In the admin panel they add something like <code>&lt;reference name=”root”&gt;&lt;action method=”addBodyClass”&gt;&lt;className&gt;caravan-motorhome-lighting&lt;/className&gt;&lt;/action&gt;&lt;/reference&gt;</code> to each and every category not using the attribute itself but adding the class directly. As I already have an attribute, I surely don't want do clone it and add the class this way.</p></li>
  </ol>
  
  <p>So what my favourite solution would be is some layout update I can add to the local.xml that says </p>
  
  <pre><code>&lt;reference name=”root”&gt;
      &lt;action method=”addBodyClass”&gt;
          &lt;className&gt;
              get value of my custom attribute here dynamically
          &lt;/className&gt;
      &lt;/action&gt;
  &lt;/reference&gt;
  </code></pre>
  
  <p>Does anyone have an idea how this could work or another idea that I didn't even think of?</p>