Skip to main content
added 30 characters in body
Source Link
Marius
  • 198.5k
  • 55
  • 424
  • 833

I am trying to add multiple classes to body tag in magento using addbodyclass method in my local.xml file.

Code in my local.xml file

` `
<reference name="root">
     <action method="addBodyClass">
        <className helper="mymodule/addbodyclass/addClasses" />
     </action>
</reference>

Code in my Helper class in a custom module:

class Mycompany_Mymodule_Helper_Addbodyclass extends Mage_Core_Helper_Abstract
{
    public function addClasses() {
        return "classname1 classname2 classname3";
     }
}

This adds classes in one string like this:

classname1-classname2-classname3

in the body tag.

Instead of spaces it adds dash(-). I know this is default behavior of magento. But is there a way to actually add spaces and not dash(-).

Thank You

I am trying to add multiple classes to body tag in magento using addbodyclass method in my local.xml file.

Code in my local.xml file

` `

Code in my Helper class in a custom module:

class Mycompany_Mymodule_Helper_Addbodyclass extends Mage_Core_Helper_Abstract
{
    public function addClasses() {
        return "classname1 classname2 classname3";
     }
}

This adds classes in one string like this:

classname1-classname2-classname3

in the body tag.

Instead of spaces it adds dash(-). I know this is default behavior of magento. But is there a way to actually add spaces and not dash(-).

Thank You

I am trying to add multiple classes to body tag in magento using addbodyclass method in my local.xml file.

Code in my local.xml file

<reference name="root">
     <action method="addBodyClass">
        <className helper="mymodule/addbodyclass/addClasses" />
     </action>
</reference>

Code in my Helper class in a custom module:

class Mycompany_Mymodule_Helper_Addbodyclass extends Mage_Core_Helper_Abstract
{
    public function addClasses() {
        return "classname1 classname2 classname3";
     }
}

This adds classes in one string like this:

classname1-classname2-classname3

in the body tag.

Instead of spaces it adds dash(-). I know this is default behavior of magento. But is there a way to actually add spaces and not dash(-).

Thank You

Source Link

Is there any way to add MULTIPLE classes to body tag in magento

I am trying to add multiple classes to body tag in magento using addbodyclass method in my local.xml file.

Code in my local.xml file

` `

Code in my Helper class in a custom module:

class Mycompany_Mymodule_Helper_Addbodyclass extends Mage_Core_Helper_Abstract
{
    public function addClasses() {
        return "classname1 classname2 classname3";
     }
}

This adds classes in one string like this:

classname1-classname2-classname3

in the body tag.

Instead of spaces it adds dash(-). I know this is default behavior of magento. But is there a way to actually add spaces and not dash(-).

Thank You